在SAP S/4HANA应用程序中使用nodejs搜索大excel文件
我想寻求一些帮助,以解决我面临的问题(不是javaScript开发人员,裸露的。)。任何帮助都将不胜感激。
Process :用户从UI上传选定的Excel文件。在后端,我们使用XLSX/ExcelJS Javascirpt库(尝试 - 相同的最终结果)来处理文件,以填充以后用途的自定义数据结构。
问题:带有大excel文件(来自10k行,更多,带有很多属性),我得到以下错误:
...错误:损坏的邮政编码:找不到中央目录的末端。
附加信息:通过在Plain Nodejs Server上运行相同的代码(本地) - 它可以工作。在SAP服务器上 - 没有。使用小文件 - 一切都很好。
Tech: SAP S/4HANA,ODATA V4,XLSX V0.18.5,ExcelJS v4.3.0,node> = v12。
代码示例:
//与exceljs库 FROFXLSX_1:async(buffer,cols)=> { const workbook = new exceljs.workbook(); 等待Workbook.xlsx.load(buffer); //< - 错误 workbook.worksheets.foreach(功能(表){ //一些代码 }); },, //带有XLSX库 FROFXLSX_2 :( buffer,cols)=> { var book = xlsx.read(buffer,{type:'buffer',celldates:true,cellText:false); //< - 错误 var sheet = book.sheets [book.sheetnames [0]]; const结果= xlsx.utils.sheet_to_json(表,{header:object.entries(cols).map(a => a [0]),raw:true}); //一些代码 }
如果需要更多信息,请询问。 谢谢你的宝贵时间。
I would like to ask for some help with solving the problem I'm facing (not a javascript developer, bare in mind. ). Any help would be grateful.
Process: User uploads selected excel file from UI. In back-end we process file with xlsx/exceljs javascirpt libraries (tried both - same end result) to populate custom data structures for later uses.
Problem: with big excel files (from 10k rows and more, with lots of attributes) I get following error:
...Error: Corrupted zip: can't find end of central directory.
Additional info: by running the same code on plain nodejs server (locally) - it works. On SAP server - it doesn't. With small files - all good.
Tech: SAP S/4Hana, OData v4, xlsx v0.18.5, exceljs v4.3.0, node >=v12.
Code example:
//with exceljs library fromXlsx_1: async (buffer, cols) => { const workbook = new ExcelJS.Workbook(); await workbook.xlsx.load(buffer);//<-- error workbook.worksheets.forEach(function(sheet) { //some code }); }, //with xlsx library fromXlsx_2: (buffer, cols) => { var book = XLSX.read(buffer, { type: 'buffer', cellDates: true, cellText: false);//<-- error var sheet = book.Sheets[book.SheetNames[0]]; const result = XLSX.utils.sheet_to_json(sheet, { header: Object.entries(cols).map(a => a[0]), raw: true }); //some code }
If more information is needed- ask away.
Thank you for your time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
设法解决了它。
根本原因是 - 缺乏知识和包装“ bubboy”的实施(推定,同事将自定义软件包写入“处理”文件,没有犯错)。
如果您偶然发现了像我一样的类似问题,请仔细检查“ bubboy”实现,如果它正确解析文件并等待所有文件处理 - 使用异步/等待概念。
Managed to solve it.
The root cause were - lack of knowledge and the implementation of package "busboy" (made a presumption, that colleagues, that wrote the custom package to "process" files, did not make a mistake).
If you stumble on similar problem like me, double check the "busboy" implementation, if its parsing the file correctly and it WAITS for the the file to be processed all - with async/await concept.