Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

One LOAD statement from two sheets in same Excel Workbook

Hi,

I'm trying to figure out how to load data (with the same format and headers) from two tabs in Excel, "Incoming" and "Outgoing".

Can I state the two sheets in the FROM statement maybe?

Any ideas?

Kind Regards,

Olle


1 Solution

Accepted Solutions
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

You can do a for each loop like

for each vSheet in 'Incoming', 'Outgoing'

  MY_TABLE

  LOAD

    *

  FROM XL.xls (biff, embedded labels, table is [$(vSheet)])

;

NEXT vSheet

(I think that work )

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!

View solution in original post

5 Replies
alexandros17
Partner - Champion III
Partner - Champion III

You must load them one by one with 2 loads or in a for next loop

alkesh_sharma
Creator III
Creator III

IF your sheet name is sheet1 and sheet2 (Numerically Ascending), you can achieve it using loop. but if the sheets have completely independent name like 'East' and 'West' then you have to load them separately.

Anonymous
Not applicable
Author

Hi Olle,

If you are using the Table Files... wizard to import data then you need to use the "Tables" drop down on the first screen of the wizard to select which sheet to import.

If the fields are identical between sheets then you can copy an existing load statement and change the sheet name manually (find the "table is @tablename").

If you have multiple identical sheets, or sheets are dynamically added then a loop might become more efficient, but this can be more complex to set up.

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

You can do a for each loop like

for each vSheet in 'Incoming', 'Outgoing'

  MY_TABLE

  LOAD

    *

  FROM XL.xls (biff, embedded labels, table is [$(vSheet)])

;

NEXT vSheet

(I think that work )

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!
Not applicable
Author

Perfect! Thanks a lot.

Works like a charm. A bit slower than two separate LOADS for som reason but works great for my purpose.

Kind Regards,

Olle