Excel export interface

Excel export interface

priyankasgoudar33
Enthusiast Enthusiast
1,115 Views
6 Replies
Message 1 of 7

Excel export interface

priyankasgoudar33
Enthusiast
Enthusiast

[ FlexSim 20.0.10 ]

How do i export data from global table to excel automatically. whenever i run the model. Please do help

0 Likes
Accepted solutions (1)
1,116 Views
6 Replies
Replies (6)
Message 2 of 7

Jeanette_Fullmer
Community Manager
Community Manager
Accepted solution


Hello @mary,

You can export a global table to excel by using this tool in the tool box.

1653599041902.png


You can also use code to export. You can find more details of how to accomplish this in the manual.

" To execute your custom import or export code through a flexscript node or trigger, call the following: "

treenode excelauto = Model.find("Tools/ExcelAuto");
executefsnode(getvarnode(excelauto, "CustomImport"),NULL);
// or
executefsnode(getvarnode(excelauto, "CustomExport"),NULL);
0 Likes
Message 3 of 7

priyankasgoudar33
Enthusiast
Enthusiast
Thank you but I'm looking for automatic export when I restart the model
0 Likes
Message 4 of 7

jason_lightfoot_adsk
Autodesk
Autodesk
Then you would put that code in one of the model triggers found in the Toolbox.
0 Likes
Message 5 of 7

priyankasgoudar33
Enthusiast
Enthusiast
can you please let me know what to write in custom code i want to open excel workbook and mention sheet, referring to the particular global table and then exporting to excel.
0 Likes
Message 6 of 7

Jeanette_Fullmer
Community Manager
Community Manager
{ // ************* PickOption Start ************* //

/**Example Custom Export*/
string directory = modeldir();
if (stringlen(directory) < 3) directory = documentsdir();
string filename = filebrowse("*.xls*","Excel Files",directory); // get the name of the file to open
if (stringlen(filename) == 0) {  // This is true when the user presses Cancel on the file browse window
  return 0;
}

excelopen(filename); // open a link with an Excel workbook

excelsetsheet("Sheet1"); // set the active worksheet - sheet names should contain only alphanumeric characters and underscore (_)

//add your export code here using commands: excelwritenum(), excelwritestr(), excelexporttable()

msg("Excel Export","Export complete",1);

excelclose(1); // save and close the workbook

} // ******* PickOption End ******* //
0 Likes
Message 7 of 7

kavika_faleumu
Autodesk
Autodesk

Hi @mary, was Jeanette F's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes