| 148 | |
| 149 | |
| 150 | def 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 | |
| 166 | def parse_csv(file_path: str, extract_image: bool = False) -> List[dict]: |