Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Loading tables from a list of table names stored in an excel spreadsheet

Hello,

I have an OLE DB connection to a database and I have a long list of tables (~40) that I need to load. The table names are stored in an xls spreadsheet. I loaded the table names into QV into a field called 'TableName'. Is there a way for me to loop through and load these tables automatically? I also wrote a script to do the actual load, which I will implement using an include statement.

Thanks!

Liz

2 Replies
maxgro
MVP
MVP

Try this

EXCEL:

load * inline [

TableName

one

two

three

];

FOR i=0 to NoOfRows('EXCEL')-1

  let t=Peek('TableName', $(i));

  trace table to read is $(t);

  set st= SELECT * FROM $(t);

  trace sql statement is $(st);

  $(t):

  LOAD *;

  SQL

  $(st);

NEXT;

Anonymous
Not applicable
Author

Thank you, Maxgro! This worked!

Liz