XLSX.writeFile not working in Electron #1994
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
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#1994
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
Hi there,
I am experiencing an issue which XLSX.writeFile(workbook, filename); is not working in Electron. There is no error but no file is being downloaded
The electron demo calls
showSaveDialog
, so you might need to call it first and get a path that you can then write to.If you are doing that and still finding an error, a similar issue was reported by @ianjennings in https://github.com/SheetJS/sheetjs/issues/1981 -- I believe the APIs were changed between 1.7.5 and now and you need to use
showSaveDialogSync
.@ianjennings is the
nodeIntegration
parameter required for writing files?showSaveDialogSync works. However, I dont want to introduce electron specific api in the code base. Ideally, if the lib can detect the environment and handles internally
That's fair, the library already does some environment checking in writeFile. We'd have to implement some ideas from https://github.com/electron/electron/issues/2288 to test where we are running in electron (main or renderer process)
Thanks for the prompt reply, meanwhile, I put a note in the code base and come back to it once a new version released.
@ldsenow Could you please share how did you work it out, i'm also trying to create new workbook and and save in my path 'D:\out.xlsx' with array of json objects.
@shaikarifrizwan I use Quasar which gives me the platform detection. https://quasar.dev/options/platform-detection
If you like you could go and check out their source code how to detect the platform. I assume it is gonna be whole bunch of string pattern matching.
Hi.
XLSX.writeFile
works when tested using the main and renderer processes in Electron. The current Electron demo is broken due to API changes inshowSaveDialog
and is being fixed in this PR #2027. Please refer to the demo on proper usage for Electron.