Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Friends,
Is this possible to import multiple sheets from an excel file at once? If yes then please share the steps or logic for that.
Regards
Bhawna
Hi
If you mean using a wildcard like *, then no. You need to loop over the sheets. You can use a For loop, like:
For i = 1 To 10
LOAD * From Mysheet.xlsx (ooxml, sheet is Sheet$i));
Next
If the names never change:
For Each vSheet In 'Detail', ''Summary', 'Last Year'
LOAD * From Mysheet.xlsx (ooxml, sheet is $(vSheet));
Next
Or if the names are more complicated, you can use an ODBC connection to get the list of sheet names and loop over this list.
HTH
Jonathan
Hi
If you mean using a wildcard like *, then no. You need to loop over the sheets. You can use a For loop, like:
For i = 1 To 10
LOAD * From Mysheet.xlsx (ooxml, sheet is Sheet$i));
Next
If the names never change:
For Each vSheet In 'Detail', ''Summary', 'Last Year'
LOAD * From Mysheet.xlsx (ooxml, sheet is $(vSheet));
Next
Or if the names are more complicated, you can use an ODBC connection to get the list of sheet names and loop over this list.
HTH
Jonathan
Thanks Jonathan,
with little changes
replace sheet is with Table is and Sheet$i with Sheet$(i)
after making changes the script runs fine and load all the sheet at once.