Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

connection string to connect excel in script side

HI All,

I want to write a connection string to connect excel in script side so how to write connection string in qlikview and in that excel sheet I have multiple sheet so for that i want to connect excel with connection string.QlikTech Admin

2 Replies
anbu1984
Master III
Master III

Click Table Files in Edit script and select your excel file. Then it will open below File Wizard. Here in Tables drop down, select your sheet name and click finish

Select_sheets_from_excel.bmp

LOAD col1,col2 ...

FROM

[Your_File_name.xlsx]

(ooxml, no labels, table is your_sheet_name);

Not applicable
Author

Hi,

You can use the below sample code:

let vTargetPath = 'C:\Excel\';

for each vFile in filelist('$(vTargetPath)*.xlsx')

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

sheets:

SQLTABLES;

DISCONNECT;

for i = 0 to NoOfRows('sheets')-1

  let vSheet = PurgeChar(Peek('TABLE_NAME', $(i), 'sheets'), '$');

  ExcelDoc:

  LOAD *

  FROM

  $(vFile)

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

NEXT

DROP Table sheets;

NEXT

If you have 1 excel file only, just provide the full document path to the vTargetPath and remove the outer for...next.

Hope this helps.