question

Aniket Singh avatar image
0 Likes"
Aniket Singh asked Aniket Singh commented

How to export global table values to an existing Excel file?

Hi FlexSim Team,

I am using the dashboard button to export the values from a global table to an existing Excel file, as a new sheet. Could you please help me with the example code for the same?

Thanks and Regards,

Aniket Singh

FlexSim 22.2.4
export data
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Aniket Singh commented

A simple example that let's you export an entire table would be the following.

excelopen("FilePath");
excelcreatesheet("NewSheet"); excelsetsheet("NewSheet"); excelexporttable("GlobalTable1", startRow, startCol, numRows, numCols); excelclose(1);

You can also write values cell by cell, for example to copy row and column headers. I'd suggest you look through the relevant commands (starting with "excel") to see what's possible.

https://docs.flexsim.com/en/22.2/Reference/CodingInFlexSim/CommandReference/CommandsIndex.html

· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Aniket Singh avatar image Aniket Singh commented ·

Hi Felix, thanks for your reply.

excelopen("FilePath") this command is not working for me and pops up unable to open the file(This may be happening since I am using a Macbook).

Is there any other command which can replace the excelopen("FilePath").

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Aniket Singh commented ·

What filepath did you paste in? If you copy it from Windows, make sure to replace the back slashes with forward slashes.

It should for example look something like this:

"C:/Users/felix/Downloads/exporttest.xlsx"

0 Likes 0 ·
Aniket Singh avatar image Aniket Singh Felix Möhlmann commented ·

Hi, I just coped the file wherein slashes were backward(

C:\Mac\Home\Desktop\Results.xlsx)

, when used forward slashes it's working.

Thanks

0 Likes 0 ·