MCPcopy Create free account
hub / github.com/AMAP-ML/Thinking-with-Map / parse_excel

Function parse_excel

demo/qwen_agent/tools/simple_doc_parser.py:150–163  ·  view source on GitHub ↗
(file_path: str, extract_image: bool = False)

Source from the content-addressed store, hash-verified

148
149
150def parse_excel(file_path: str, extract_image: bool = False) -> List[dict]:
151 if extract_image:
152 raise ValueError('Currently, extracting images is not supported!')
153
154 import pandas as pd
155
156 excel_file = pd.ExcelFile(file_path)
157 md_tables = []
158 for sheet_name in excel_file.sheet_names:
159 df = pd.read_excel(file_path, sheet_name=sheet_name)
160 md_table = df_to_md(df)
161 md_tables.append(f'### Sheet: {sheet_name}\n{md_table}')
162
163 return [{'page_num': i + 1, 'content': [{'table': md_tables[i]}]} for i in range(len(md_tables))]
164
165
166def parse_csv(file_path: str, extract_image: bool = False) -> List[dict]:

Callers 3

parse_csvFunction · 0.85
parse_tsvFunction · 0.85
callMethod · 0.85

Calls 1

df_to_mdFunction · 0.85

Tested by

no test coverage detected