Load latest Excel file code example
Example: Load latest Excel file
LET vFilePath = 'C:\Qlikview\Data';
FOR EACH file in FileList('$(vFilePath)\*.xlsx'); // Loops each excel file in the given Folder
LET vFileYear = Left(Right(file, 9), 4); // Gets the year portion from the filename
LET vMaxYear = Rangemax(vFileYear, vMaxYear); // Gets the max year for every iteration
NEXT
Data:
LOAD *
FROM
[$(vFilePath )\Budget $(vMaxYear).xlsx] // Load Max year data
(ooxml, embedded labels, table is [Sheet1]);