Making multiple Excel-Sheets

Started by René, March 01, 2021, 14:44:27 PM

Previous topic - Next topic


I wanna write an export with more than one sheet:

// Create a new Excel file with a default font and colour
var excel = $"Calibri 12 #333333");

// Add a new sheet with a name
excel.set( { sheet:0, value:type0 });

// Add a new sheet with a name
excel.set( { sheet:1, value:"res" });

The last line I got the following message:
Script Error: javax.script.ScriptException: Bad sheet 1 in file: [..]lib/myexcel.js at line number 210 at column number 28

What's wrong?

Phil Beauvoir

I looked at the source code for myexcel.js and found that you have to add the sheet like this:


It seems a new Excel object adds one sheet by default (0) so the call to set is only setting its name.
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.



That means: the first one is still existing by creating, so I just have to give them a name.