question

Arun Kr avatar image
0 Likes"
Arun Kr asked Matthew Gillespie commented

excelcreateworkbook Command Not Working

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


FlexSim 23.2.1
excel export
· 1
5 |100000

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

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

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 0 ·

1 Answer

·
Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered Matthew Gillespie commented

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.

· 1
5 |100000

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

Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·

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

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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