Multiple issues updating named items in a file #3199
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#3199
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hello! I'm trying to use your library to update some named items in an Excel file and we're running into 3 problems. I'm happy to break these into separate tickets if that's helpful.
We're using version 0.23.0. We're running this in a Lambda on AWS, downloading the XLSX file from S3, making the updates, and then uploading the XLSX file to the same location.
After we download the file from S3, it gets saved to local storage, then we're opening it with
Once we make our updates, we write the file with
and then send that output to S3.
For our updates, there are a bunch of named items in the file. There are named items that an excel add-in of ours creates, and we go through and update a named id with a Name of
ABCDE
to have a Name of12345
and then save the file. We also do some reading of the data in those named items and save them in our database as well. All of that appears to be working fine.The issues...
45291
instead ofDecember 31, 2023
.Any thoughts as to what might be going on here? Happy to provide whatever other information might be needed.
I'm not a maintainer but might be able to help with 3. To convert Date values we found a separate package that helps (we could have implemented the logic ourselves too), I'm not sure if that's correct or best way but does work. Also, if it isn't I'd be interested to understand a better way
I've updated my test source workbook and removed all of the linked formulas that were referencing external files. I've also got a simple script that is just opening the file and saving the file (no modifications).
XLSX.readFile('./source.xlsx', {type: 'file', cellNF: true})
and my write to beXLSX.writeFileXLSX(_workbook, './output.xlsx', {bookType: 'xlsx', compression: true, cellDates: true})
. The destination file is 20MB (which the source file is only 10MB), but it appears that the date problem is solved with one of those as well.The remaining questions then come from:
You can pass
compression: true
to enable compression (which can be optimized further, as shown in the example). If there are many repeated strings,bookSST: true
de-duplicates strings at the expense of memory usage.External workbook references are not currently supported. They were added in our Pro builds thanks to some customer requests, but we will look into porting support here.
The default options will be changed at some point, probably the 1.0 release, but you should pass
cellNF: true
to theread
function to expose number formats.Thanks! Can you provide a link to the demo you referenced that outlines the compression options? All I've found is
compression: true
.bookSST
is mentioned in passing in "Writing Options": https://docs.sheetjs.com/docs/api/write-options#writing-optionsAs discussed in the SheetJS Discord (you will need to join https://discord.gg/sheetjs first in order to see that link), there are a few reasons for the size difference:
The DEFLATE implementation is optimized for IE compatibility at the expense of runtime performance and at the expense of file size. If we were to drop IE compatibility and focus on latest Chrome / NodeJS, more performant algorithms could be used.
bookSST
is disabled by default since the shared string table construction is memory intensive. Excel generates XLSX files with the shared string table by default.There are a few places where SheetJS generates sub-optimal XML to work around some LibreOffice bugs.
We are keeping this issue open until we decide how to proceed.
We definitely don't need IE compatibility. Is configuring another compression implementation something I can do on my side?