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

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

214219004_nitt
Contributor Contributor
65 Views
4 Replies
Message 1 of 5

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

214219004_nitt
Contributor
Contributor

[ FlexSim 22.2.4 ]

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

0 Likes
Accepted solutions (1)
66 Views
4 Replies
Replies (4)
Message 2 of 5

moehlmann_fe
Participant
Participant
Accepted solution

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

0 Likes
Message 3 of 5

214219004_nitt
Contributor
Contributor

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
Message 4 of 5

moehlmann_fe
Participant
Participant

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
Message 5 of 5

214219004_nitt
Contributor
Contributor

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