Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how do I get this code to work

For Each vFile in FileList('[Recording Sheet]')

ODBC CONNECT32 TO '[Excel Files;DBQ=$(vFile]';

 

     Sheets:

     SQLTABLES;

 

     DISCONNECT;

     For i = 0 To NoOfRows('Sheets')-1

          Let vSheet = left(Peek('TABLE_NAME', i, 'Sheets'), len(Peek('TABLE_NAME', i, 'Sheets'))-1);

          LOAD '$(vSheet)' as [Tab Name], *

          From [$(vFile)]

          (ooxml, embeddd labels, table is $(vSheet));

     Next;

Next

1 Solution

Accepted Solutions
Not applicable
Author

this is what i have and it is still not loading the data

addimage.PNG

View solution in original post

5 Replies
Gysbert_Wassenaar

A missing parenthesis:

ODBC CONNECT32 TO '[Excel Files;DBQ=$(vFile)]';


Dollar expanding the variable i might help:

Let vSheet = left(Peek('TABLE_NAME', $(i), 'Sheets'), len(Peek('TABLE_NAME', $(i), 'Sheets'))-1);


To be honest I don't understand why you're removing the last character of the sheet name. That could prevent the load statement from finding the right excel table.


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

For Each vFile in FileList('[Recording Sheet]')

ODBC CONNECT32 TO '[Excel Files;DBQ=$(vFile]';

Shouldn't you give a path to an excel file here? I also think the single quotes are not correct and you are missing a closing ];

ODBC connection to Excel file

Not applicable
Author

Hi,

the following is what I am trying to follow from Maxgro: Re: How to load EXCEL worksheets and retrieve tab names

Not applicable
Author

I don't want to remove the last character; I am just following this:

Re: How to load EXCEL worksheets and retrieve tab names

Not applicable
Author

this is what i have and it is still not loading the data

addimage.PNG