question

David VC avatar image
0 Likes"
David VC asked David VC commented

How to import different excel files for different scenarios?

Hi

I am currently struggling to get a grip on how I should import excel files to flexsim for different scenarios.

The problem is as follows: i have a global table: "rack_location" which gives the location of an item on a rack corresponding to its sku-id. Now I need to import different excel sheets for this rack_location globaltable for every different scenario. How should I do this such that I can control which sheet gets read in based on globalvariables defined by the scenario. ( an example of the globalvariable is for example: storage policy. This gives different locations for an sku for every different storage policy. )

Also I have a lot of excel sheets so it would be awesome to make this "automated".

Best regards

David Van Crombrugge

Choose One
experimenterexcel import
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

·
Joshua S avatar image
0 Likes"
Joshua S answered David VC commented

Use this code

excelopen("FileName.xlsx");//ie "C:/Users/user/Documents/Book1.xlsx"
excelsetsheet("Sheet"+numtostring(Sheet));//Global Variable named Sheet 
excelimporttable("GlobalTable1",num_startRow,num_startCol,num_Rows,num_Cols);
excelclose(0);

Replace what you need with your sheet names and global variable names. Your Global Table will need to have the same number of rows and columns as your sheets for it to import correctly with this method.

· 3
5 |100000

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

David VC avatar image David VC commented ·

Hey @Joshua S

Many thanks!!! Where do I need to place this code to make sure my globaltables are adapted before the actual simulation run when a new scenario in the experimenter is started?

Best regards

0 Likes 0 ·
Joshua S avatar image Joshua S David VC commented ·

I would put it on a model reset trigger.

0 Likes 0 ·
pic1.png (57.5 KiB)
David VC avatar image David VC commented ·

Thanks a lot!

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.