excelcreateworkbook Command Not Working

excelcreateworkbook Command Not Working

arunTTT2P
Explorer Explorer
16 Views
3 Replies
Message 1 of 4

excelcreateworkbook Command Not Working

arunTTT2P
Explorer
Explorer

[ FlexSim 23.2.1 ]

excelcreateworkbook();
excelsetsheet("Sheet1");
excelwritenum(1,1,1);
excelsave("NewWorkBook.xlsx");
excelclose(0);

Hi, On using this script I'm not able to create an Excel workbook with the specified sheet and data.

Regards,

Arun KR


0 Likes
Accepted solutions (1)
17 Views
3 Replies
Replies (3)
Message 2 of 4

JordanLJohnson
Autodesk
Autodesk
Accepted solution

Looks like the Excel Interface expects paths with windows-style slashes for the file path. So I made a test model (so that modeldir() becomes valid) and then used string.replace() on the slashes:

excelcreateworkbook();
excelsetsheet("Sheet1");
excelwritenum(1,1,1);
excelsave(modeldir().replace("/", "\\", 1) + "NewWorkBook.xlsx");
excelclose(0);

With this change, it seems to work.

I'll add a case to the dev list to improve this in the future.

.


Jordan Johnson
Principal Software Engineer
>

0 Likes
Message 3 of 4

jason_lightfootVL7B4
Autodesk
Autodesk

Hi @Arun Kr, was Jordan Johnson'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 comment back to reopen your question.

0 Likes
Message 4 of 4

Matthew_Gillespie
Autodesk
Autodesk

@Arun Kr This issue is fixed in 23.0.13 and 23.2.3 released today.



Matthew Gillespie
FlexSim Software Developer

0 Likes