cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
GroupSquareWolf
Level III

Scripting : Multiple tables from Excel

Writing a script to open  Excel files that contain multiple sheets then do independent analysis with each individual sheet. The names and number of sheets from different Excel files can be different, so would like to write a generic code that can work on different files.

 

Used Open command to open the file

dt = Open ("file path");

 

This particular example file has three sheets, so show (dt); gives this result in log:

dt = {DataTable("Sheet 1"), DataTable("Sheet 2"), DataTable("Sheet 3")}

;

Need to assign each datatable in dt to different variables, what is the correct syntax to do that?

 

I tried:

dt1 = dt (1);


It did not work. dt1 essentially equals dt. show (dt1); gives this result in log:

dt1 = {DataTable("Sheet 1"), DataTable("Sheet 2"), DataTable("Sheet 3")};

 

Thanks!

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Scripting : Multiple tables from Excel

dt seems to be a list, so reference items by using indices

dt[1]

if you have JMP16 For Each might also be helpful

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: Scripting : Multiple tables from Excel

dt seems to be a list, so reference items by using indices

dt[1]

if you have JMP16 For Each might also be helpful

-Jarmo