[optimization] The process of reading an Excel file with 1,000,000 empty rows is inefficient and requires optimization.
hi bro. 综合项目需确认厉彬.xlsx
当文件包含了100万条空行,读取这个文件非常耗时
The process of reading an Excel file with 1,000,000 empty rows is inefficient and requires optimization.
i set ignoreEmptyRows to true, it seems no effect.
{width=696 height=983}
export const readExcel = async (filepath, filterSheetName = (name) => true) => {
try {
const blob = await streamToBlob(window.fs.createReadStream(filepath), null);
const sheetNames = await readSheetNames(blob);
const sheetData = await Promise.all(sheetNames.filter(filterSheetName).map(async (sheetName) => {
const data = await readXlsxFile(blob, { sheet: sheetName, ignoreEmptyRows: true });
return {
sheetName,
data
};
}));
return sheetData;
} catch (error) {
throw new Error("读取Excel文件时发生错误,请尝试使用 Microsoft Office 或 WPS Office 打开文件并重新保存,然后再尝试。错误详情: " + error.message);
}
};
Edited by tomnattle
