I am trying to loop sheets and Excel workbooks. The data structure in all the sheets in all the workbooks is the same but each workbook has different number of sheets. I tried to use the below code and it works when excel workbooks has same number of sheets but doesn't work if the number of sheets in each workbook are not the same
Ex: When Q_Excel1.xlsx has 4 sheets and Q_Excel2.xlsx has 5 sheets below code doesnt work but when Q_Excel1.xlsx has 4 sheets and Q_Excel2.xlsx has has 4 sheets it works.
ODBC CONNECT TO [Excel Files;DBQ=C:\Desktop\Excel1.xlsx];
(ooxml, no labels, header is 17 lines, table is '$(sheetName)');
FOR j = 0 to $(var)-1
let sheetName=subfield(peek('TABLE_NAME', j,'tables'),'$',1);