Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hei,
Maybe someone owns a code that allows to load data from one single cell from multiple sheets from excel to QV?
1. Sheet names are unknown.
2. The cell I need is in B3.
I have attached the excel file and have been trying for a while.
Any ideas would be appreciated.
Thank you!
The script:
ODBC CONNECT TO [Excel Files;DBQ=C:\Users\Mindaugasb\Desktop\QV.xlsx];
tables:
SQLtables;
DISCONNECT;
FOR i = 0 to NoOfRows('tables')-1
LET sheetName = purgeChar(purgeChar(peek('TABLE_NAME', i, 'tables'), chr(39)), chr(36));
Table:
Load * ,
FileBaseName()as File,
FileDir() as Dir,
FileName() as File_Name,
'$(sheetName)' as Sheet_name,
RowNo() as nr
From $(file)(ooxml, no labels, table is [$(sheetName)], filters(
Remove(Row, Pos(Top, 2)),
Remove(Row, Pos(Top, 1))
));
NEXT i
The story is that I have faced few issues:
Hello!
Try this:
FOR i=1 TO 3
LOAD
A
FROM
(ooxml, no labels, table is Sheet$(i));
NEXT
I've checked this option:
Load Multiple excel sheets using For loop
I would like to update my task. Sheet names are not predefined.
anyway you need to know names and count of sheet
You can use just several loads and concatenate
If the cell is always the same (B3) then you can use a transformation in the load script to remove the rows in the spreadsheet above B3 and add a "first 1" command before the load so you only load 1 row of data.
Then just select column B.
Finally use this load in your loop to get the data from all sheets.
The script:
ODBC CONNECT TO [Excel Files;DBQ=C:\Users\Mindaugasb\Desktop\QV.xlsx];
tables:
SQLtables;
DISCONNECT;
FOR i = 0 to NoOfRows('tables')-1
LET sheetName = purgeChar(purgeChar(peek('TABLE_NAME', i, 'tables'), chr(39)), chr(36));
Table:
Load * ,
FileBaseName()as File,
FileDir() as Dir,
FileName() as File_Name,
'$(sheetName)' as Sheet_name,
RowNo() as nr
From $(file)(ooxml, no labels, table is [$(sheetName)], filters(
Remove(Row, Pos(Top, 2)),
Remove(Row, Pos(Top, 1))
));
NEXT i
The story is that I have faced few issues: