Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
vikasmahajan

Load excel files dynamic and check whether excel file is changed or modify if yes load into qvd

Dear Team ,

I have  12 files like AssetTrackingAug1.xlsx , AssetTrackingSep1.xlsx , AssetTrackingOct1.xlsx ,etc .

1. I want to load this dynamically and save it into QVD.

2. if  AssetTrackingAug1.xlsx  file  modified later then this should pickup for loading

Thanks

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
18 Replies
vikasmahajan
Author

Does Any one have solution for this ??

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Peter_Cammaert
Partner - Champion III
Partner - Champion III

There are two script functions that may be useful:

  • FileTime(filename) = reports the last modification time of the specified file (e.g. your Excel files)
  • QvdCreateTime(filename) = returns the creation timestamp of the Qvd file specified (e.g. your QVD). This tilestamp is read from the XML-header, not from the file system

Compare the two for all files matching a file name pattern (e.g. AsseTracking????.xlsx) and reload the Excel files that are newer than your QVD. You can use a FOR EACH loop to do that.

Best,

Peter

vikasmahajan
Author

Idea is good , searching for code.

Thanks

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
vikasmahajan
Author

can you help me in build this code ?

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
PradeepReddy
Specialist II
Specialist II

Hi Vikas,

Please find the attachment. It might be helpful.

Note:

For each file the sheet name is consistent. based on this assumption, In October file, I changed the Sheet name.

Thanks,

Pradeep

Kushal_Chawda

Hi Vikas,

Please find the attached QVW file.

Open QVW file and go to script,

Replace the Excel file path and QVD path with your actual path (Variables are created in Main Tab)

I have divided scripts in Three parts


1 Tab - Load all excel file Code. This is first part of the code which will create the QVD file for all the excel files currently available in folder.


Note- You should comment this code once QVD is created to check the New or updated file on next reload.

2 Tab - Code to check if any New file is arrived in folder. If new file is arrived it will load Only New file and will Overwrite the existing QVD with New file data.


3 Tab - Code to check if existing file is update or not using Filetime() function. If file is updated it will load only updated file and will overwrite the existing QVD with updated data.


I hope this will help.


Kushal_Chawda

Hi Vikas,

Please find the updated application which works for me with the scenario I have mentioned in my above post

vikasmahajan
Author

Thanks Kush !!

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
vikasmahajan
Author

For third part  it is taking to much time , can we have timestamps logic with file.  if file time is changed then delete records from qvd and take whole new file into qvd.

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.