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

Script use Excel List to SQL resquest

Hello,

I don't if it's possible...

I have an Excel file like this :

     Num_Customer
     0123
     5156
     9656

     ...

1. I want load this file in my script  --> OK

(using : LOAD Num_Customer FROM [path:excel_file.xls] (biff, embedded labels, table is feuil1$);

2. Use it in SQL request like : --> KO

Name_TABLE : SELECT * FROM SQL_table_Name WHERE Customer IN ( MY_CUSTOMER_IN_EXCEL_LIST)

I know it's possible to use 'Entry field' (using : '0123', '5156','9656')


Somebody to help ?? Thanks.

11 Replies
maxgro
MVP
MVP

for 100 customers you can try to build a Qlik variable and use it in SQL statement

// replace woth your excel file

excel:

load * inline [

Num_Customer

     0123

     5156

     9656

     100

     200

];

filter:

load

  chr(39) & concat(Num_Customer, chr(39) & ',' & chr(39)) & chr(39) as f

Resident excel;

let vfilter = Peek('f');

drop table filter;

now use the variable vfilter

Name_TABLE:

SQL

SELECT * FROM SQL_table_Name WHERE Customer IN ($(vfilter));

Not applicable
Author

Hi,

Thanks Massimo, it's seem work perfectly.

Sorry Krishna, today i try directly Massimo solution.

Thanks to your help.

Simon