The file size I exported was about double the actual value #2988

Closed
opened 2023-09-12 07:42:09 +00:00 by nande324 · 2 comments

The file size I exported was about double the actual value, but if I open it and save it directly, I can get it back to normal size.
The attached table was generated by my test code, and I omitted some data
Figure 1 shows the test file before and after it was saved
Figure 2 shows the actual file before and after saving
//This is my test code: let tempData=[ { 'test1':'t1', 'test2':'t2', 'test3':'t3', 'test4':'t4', 'test5':'t5', 'test6':'t6' },{ 'test1':'t1', 'test2':'t2', 'test3':'t3', 'test4':'t4', 'test5':'t5', 'test6':'t6' } ] let result={'test1':'test1','test2':'test2','test3':'test3','test4':'test4','test5':'test5','test6':'test6'} const sheet = [result, ...tempData]; const worksheet = XLSX.utils.json_to_sheet(sheet, { skipHeader: true, }); XLSX.utils.book_append_sheet(newWorkBook, worksheet, sheetList[i]); XLSX.writeFileXLSX(newWorkBook, "test.xlsx", { compression: true });

The file size I exported was about double the actual value, but if I open it and save it directly, I can get it back to normal size. The attached table was generated by my test code, and I omitted some data Figure 1 shows the test file before and after it was saved Figure 2 shows the actual file before and after saving ` //This is my test code: let tempData=[ { 'test1':'t1', 'test2':'t2', 'test3':'t3', 'test4':'t4', 'test5':'t5', 'test6':'t6' },{ 'test1':'t1', 'test2':'t2', 'test3':'t3', 'test4':'t4', 'test5':'t5', 'test6':'t6' } ] let result={'test1':'test1','test2':'test2','test3':'test3','test4':'test4','test5':'test5','test6':'test6'} const sheet = [result, ...tempData]; const worksheet = XLSX.utils.json_to_sheet(sheet, { skipHeader: true, }); XLSX.utils.book_append_sheet(newWorkBook, worksheet, sheetList[i]); XLSX.writeFileXLSX(newWorkBook, "test.xlsx", { compression: true });`
Author

Just open the file and save it, and the size of the file changes

Just open the file and save it, and the size of the file changes
Owner

There's a tradeoff between runtime performance and compression size. This has been asked multiple times and we will be revisiting this in the future. #2974 tracking issue

There's a tradeoff between runtime performance and compression size. This has been asked multiple times and we will be revisiting this in the future. #2974 tracking issue
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#2988
No description provided.