I've got a daily automated function in nodejs which builds and populates an excel spreadsheet via the package xlsx-populate
, which has been running for a couple of years now with no problems.
A colleague now wants to connect this file with Power Bi, but an error occurs saying:
The input couldnt be recognised as a valid Excel Document.
DataFormat.Error: The document cannot be opened because there is an invalid part with an unexpected content type.
I believe (from this article here) that it's due to a issue within the xlsx-populate package, not saving xml correctly.
When we open, save and close the excel file (without making any changes), it works perfectly.
Is there a way that my automated function can open, save and close the spreadsheet to avoid the need to manually do this each day? Or perhaps there's another way around the problem which I haven't thought of.
Thanks
I've got a daily automated function in nodejs which builds and populates an excel spreadsheet via the package xlsx-populate
, which has been running for a couple of years now with no problems.
A colleague now wants to connect this file with Power Bi, but an error occurs saying:
The input couldnt be recognised as a valid Excel Document.
DataFormat.Error: The document cannot be opened because there is an invalid part with an unexpected content type.
I believe (from this article here) that it's due to a issue within the xlsx-populate package, not saving xml correctly.
When we open, save and close the excel file (without making any changes), it works perfectly.
Is there a way that my automated function can open, save and close the spreadsheet to avoid the need to manually do this each day? Or perhaps there's another way around the problem which I haven't thought of.
Thanks
Share Improve this question asked 2 days ago SosijElizabethSosijElizabeth 973 silver badges17 bronze badges 3- 1 Not enough information. Please see: How to create a Minimal, Reproducible Example. – Sergey A Kryukov Commented 2 days ago
- Do I really need a reproducible example when asking if there is a way to open, close and save a file? – SosijElizabeth Commented 2 days ago
- 1 Maybe ask @SergeyAKryukov how he would make an example for this. This seems like a niche error that will probably be hard to find a solution. I would compare the XML of the XLXS files before and after opening/saving ("open, save and close...works") to see what's changed and if the populate process can be fixed/changed to do the same. – Hannover Fist Commented 2 days ago
1 Answer
Reset to default 0Assuming you really just want to do what you ask...I don't see the need to tie this into the same programmatic interface, since you're effectively hacking through to a solution anyway. Decouple it from your infrastructure and just use another process script to do the excel open/close. Here is another link to an answer for how to do this, that should guide you: Open, save and close an Excel file from the command prompt without interaction
you could of course call it from this process, or set a scheduler/timer to activate it, and so on. Given the lack of other details, this should answer your question asked.