Thank you for your input.
The code was indeed crashing because of variable name of table for QVD, it has to be static. I also had few errors there in names of variables. After correcting these I came upon new error which was TABLE_NAME from Excel connection.
Excel seems to create hidden sheets when manipulating with data and that was causing crashes of load because of incorrect format of TABLE_NAME. After fixing this I have working QVD generator which won't crash even when manipulating data in excel (i.e. using autofill, new sheets etc.).
Script searches through all sheets in excel defined by variable vFile,
then for each sheet creates a QVD file with same name as in source .
//Loads all tables information in selected excel spreadsheet
for each vFile in FileList('$(vPathXLS)Data.xlsx')
ODBC CONNECT64 TO [Excel Files;DBQ=$(vFile)];
//Excel sometimes creates hidden sheets when manipulating with data and using Auto Filter,
//this temp table filters these and stops possible crashes of load
where not WildMatch (TABLE_NAME, '*_FilterDatabase');
Drop table List;
LET vSheetCount = NoOfRows('SheetList'); //Counts all sheets
// Loop for all sheets creates QVDs
FOR i = 0 to $(vSheetCount) -1
LET vSheetName = purgeChar(purgeChar(peek('TABLE_NAME', i, 'SheetList'), chr(39)), chr(36)); // clears Sheet names from '' and $ signs
'$(vSheetName)' as SourceSheet // New column with source sheet is loaded with extract, not mandatory
FROM $(vFile) (ooxml, embedded labels, table is [$(vSheetName)]);
LET vSheetName = upper ('$(vSheetName)'); // Sets source sheet name in upper case for output QVD
STORE TableData into $(vPathQVDStore)\TableData_$(vSheetName).qvd;
DROP TABLE TableData;
DROP TABLE SheetList;