question

Liam Chiu avatar image
0 Likes"
Liam Chiu asked Felix Möhlmann commented

How can I fix Excel import error?

Hi,


I am trying to import different excel files for different scenarios. In Model Trigger I use a set of code and set the global variable "Sheet", but when I use the experimenter to experiment, the excel file cannot be read. I am unsure what is causing this.


Thank you for your advance.


1663839496864.png


1663839824120.png


1663839546267.png


1663839954277.png


FlexSim 20.1.3
experimenterexcel
1663839496864.png (92.3 KiB)
1663839546267.png (27.1 KiB)
1663839824120.png (99.5 KiB)
1663839954277.png (379.6 KiB)
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

Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Felix Möhlmann commented

Use a forward slash "/" in the file path instead of a backslash "\".

excelopen("D:/Information.xlsx");

Also, based on your screenshots it looks like your global variable "Sheet" should be a string type since you assign the actual sheet name to it in the experimenter. You then also don't need to construct the name in the code.

excelsetsheet(Sheet);

Setting it up like that works without error for me.

1663843063220.png


1663843063220.png (123.4 KiB)
· 2
5 |100000

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

Liam Chiu avatar image Liam Chiu commented ·

Hi @Felix Möhlmann

I followed the information you provided above, but I don't know why I can't find the Sheet in the experimenter. Thank you very much for your assistance.


1663846804069.png

1663847072585.png

1663847122707.png

0 Likes 0 ·
1663846804069.png (307.4 KiB)
1663847072585.png (114.0 KiB)
1663847122707.png (72.1 KiB)
Felix Möhlmann avatar image Felix Möhlmann Liam Chiu commented ·

Apparently string type variables don't appear in that drop down list. Not sure if that is a bug or intended. I added it to the experimenter by first creating an empty variable and then selecting the data node from the tree.

1663848488130.png

0 Likes 0 ·
1663848488130.png (44.8 KiB)