question

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

excelcreateworkbook Command Not Working

  1. excelcreateworkbook();
  2. excelsetsheet("Sheet1");
  3. excelwritenum(1,1,1);
  4. excelsave("NewWorkBook.xlsx");
  5. 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.

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:

  1. excelcreateworkbook();
  2. excelsetsheet("Sheet1");
  3. excelwritenum(1,1,1);
  4. excelsave(modeldir().replace("/", "\\", 1) + "NewWorkBook.xlsx");
  5. 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.