Open connectsoft-smartdata opened 8 years ago
Macros are not currently supported in js-xlsx (or the styles branch of it). Excel is really ZIP file with a directory structure of XML and other documents. You may be able to extend the xlsx code base to enable that, adding the appropriate files.
You might just open the file generated by js-xlsx, unzip it using JSZip, use cheerio to parse, modify and regenerate the appropriate XML files with the VBA added, and use JSZip to generate the modified workbook.
A workflow I suggest is
~/myprojects/lab/book1/book1.xlsx
) jar -xvf book1.xlsx
) ~/myprojects/lab/
for convenience)@pietersv Thank you very much for you help and your quick answer. Indeed, I was avoiding to do it myself but I have no choice.
Thanks again !
@pietersv - I believe macros are now supported in the latest version of js-xlsx. How much effort do you think it would take to merge those updates back into this project? I've been poking around the code base, but am still pretty unfamiliar with how everything is organized, but would be happy to help if I can. If you don't have time/resources to do a merge, would you be willing to let me pick your brain and/or provide me a little guidance?
I think the better approach is to start clean with the latest js-xlsx branch and add in support for styles to that. If you're interested in organizing that, I'd be happy to help get you going, contact directly at support@protobi.com
Hi, i'm using your library which works perfectly. I was wondering if it was possible to insert a macro in the workbook.
I want to create 2 worksheets, the first being a pivot table of the second. For that I want to insert a vba macro that will create the first worksheet as pivot table created from the second worksheet.
Is there a way to insert vba script in the workbook generated by the library ?
Thanks in advance