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

How to load data from files that reside inside a table?

Hi,

I have a table with two columns (Filename and Tablename).

Example: Filename (C:\Users\Sudheep\Desktop\Test data\xyz.xlsx) and Tablename is TmpTable. Similarly, I have 10 records with filename and its corresponding table name.

I need to load all the data from the filename with the tablename in a qlikview application. Can someone help me with this logic?

Thanks

1 Solution

Accepted Solutions
jpenuliar
Partner - Specialist III
Partner - Specialist III

Hi Kartick,

Your Load Script should look something like below:

TableList:

Load * Inline

[

    Filename, Tablename

    'C:\Users\Sudheep\Desktop\Test data\xyz.xlsx','TmpTable'

];

       

let noRows = NoOfRows('TableList')-1;

for i=0 to $(noRows)

    let a = peek('Filename',$(i),'TableList');

    let b = peek('tablename',$(i),'TableList');

    LOAD   

            '$(a)' as FielName,

            '$(b)' as TableName,

            *

    FROM [$(a)]

             (ooxml, embedded labels, table is [$(b)]);

next i;

Drop table TableList;

Regards,

JP

View solution in original post

3 Replies
jpenuliar
Partner - Specialist III
Partner - Specialist III

Hi Kartick,

Your Load Script should look something like below:

TableList:

Load * Inline

[

    Filename, Tablename

    'C:\Users\Sudheep\Desktop\Test data\xyz.xlsx','TmpTable'

];

       

let noRows = NoOfRows('TableList')-1;

for i=0 to $(noRows)

    let a = peek('Filename',$(i),'TableList');

    let b = peek('tablename',$(i),'TableList');

    LOAD   

            '$(a)' as FielName,

            '$(b)' as TableName,

            *

    FROM [$(a)]

             (ooxml, embedded labels, table is [$(b)]);

next i;

Drop table TableList;

Regards,

JP

Anonymous
Not applicable
Author

Hi Jonathan,

Thanks for your reply. I tried out the logic you mentioned as below:

For i = 0 to (NoOfRows('Table2')-1)

let a = Peek('Filename',$(i),'Table2');

let b = Peek('Tablename',$(i),'Table2');

LOAD * from [$(a)]

(ooxml, embedded labels, table is [$(b)]);

next i;

For test purpose alone, i  just kept only one record.

I am able to achieve what i need. But in addition to it I am getting something different and the following script error occurred:

LOAD * from

(ooxml, embedded labels, table is [~$Null])

In addition to the file i have input I am getting one additional file named which is not in the input. The only file in the input is

Something going wrong in the loop and creating an additional wrong file by appending '~$' in front of the original file name.

Please help me on this issue

Thanks

Anonymous
Not applicable
Author

Please ignore my previous reply. I got what the issue is.

Thanks