Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
qvraj123
Contributor II

error with for loop to read from excel

Hi , thanks for your time,

could someone please guide me in the right direction -I am trying to save an excel file with multiple tabs (same columns for diff months) - when I click on reload I get multiple errors - there two sheets, one excel file in my folder from where load

1 attached script used

2 attached error messages

thanks for your time - got stuck

Raj

4 Replies
MVP
MVP

Re: error with for loop to read from excel

I have this small example, hope it helps


directory;

For Each vFile in FileList('Load_Test*.xlsx')

    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, embedded labels, table is $(vSheet));

    Next;

Next;

qvraj123
Contributor II

Re: error with for loop to read from excel

still getting the errors

thanks for your time,

Raj

padmaja_gade
New Contributor III

Re: Re: error with for loop to read from excel

Try this: Attached is the sample

qvraj123
Contributor II

Re: Re: error with for loop to read from excel

HI Padmaja, this worked - not sure what I was missing in my previous where I had two diff for statements

Thanks for your time

Community Browser