excelize icon indicating copy to clipboard operation
excelize copied to clipboard

[BUG] This xlsx file that cannot be opened seems to be stuck

Open zurmokeeper opened this issue 2 years ago • 4 comments

🐛 Bug Report

Can not open this file.

Lib version: 4.4.2

Source problem address

Steps To Reproduce

(async () => {
  const workbook = new ExcelJS.Workbook();
  const fund = await workbook.xlsx.readFile('/path/to/hang.xlsx');
  const sheet = fund.worksheets[0];
  console.log(sheet);
})()

The expected behaviour:

Possible solution (optional, but very helpful):


zurmokeeper avatar Jul 04 '23 08:07 zurmokeeper

Found this due to the data validation in the excel file has Q13:Q1048576 H13:H1048576 these so large range of validation, resulting in exceljs to read too much range, and then generate too many dataValidation objects, there are millions, stuck. Then the program just keeps stopping there.

Now is thinking how can I reproduce the problem and what to do when I encounter this problem?

zurmokeeper avatar Jul 04 '23 08:07 zurmokeeper

https://github.com/zurmokeeper/excelize/assets/1271744/1e7fc7b8-1b24-4bcd-8e42-6292f2c68d93

bleehome avatar Jul 04 '23 09:07 bleehome

@bleehome 这个视频的意思就是这样设置就会100多万的单元格也设置了数据有效性验证?

zurmokeeper avatar Jul 04 '23 14:07 zurmokeeper

@bleehome 我在V4.4.6版本加入了读取excel的时候加入忽略节点参数(ignoreNodes)可以暂时解决这个问题,通过忽略数据有效性节点来处理,具体使用可以看这里 https://github.com/zurmokeeper/excelize/releases/tag/4.4.6,不过这个只是治标的方法,治本的还得再想想。

zurmokeeper avatar Aug 13 '23 05:08 zurmokeeper