Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Lucky1
Creator
Creator

Load Data quarterly dynamically

Hi I have 2 files in my folder X

Datafile2022Q4.xls 

Datafiles2023Q1.xls

 

Soo for every quarter end one file wil l be added to my X folder.so in July month Q2 file will be added to that folder

Soo for July month I have 3 files in folder

Datafile2022Q4.xls 

Datafiles2023Q1.xls

Datafile2023Q2.xls

 

Soo every quarter we will have another fie

How can I load these files dynamically without changing my code every quarter 

 

 

 

Labels (5)
1 Reply
Lisa_P
Employee
Employee

There are some Qlik functions that can help here and depending on what you need to extract from the filename to supplement the data in your tables.

You can use a loop to iterate through each file and the data from each file should be concatenated together into one table automatically.

 

Here is an example that might work for you:

Set vFolder = 'lib://DataFiles/';
For each vDataFile in FileList (vFolder & 'Datafile2*.xlsx')
Orders:
LOAD
Textbetween(SubField('$(vDataFile)','/',-1), 'Data', 'Q') as Year,
    'Q' & Textbetween(SubField('$(vDataFile)','/',-1), 'Q', '.') as Quarter,
    OrderID,
    CustomerID,
    EmployeeID,
    ShipperID,
    Date
 
FROM [$(vDataFile)]
(ooxml, embedded labels, table is Sheet1);
Next;