Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Extract last modification date of a file

Hey all,

Is it possible to return the date of modification of a 'xls' file where my database comes from ?

I tried to use the FileTime() function but needs to use alib reference so it does not work.

Thx,

Rémi

3 Replies
mohsinqlik
Partner - Creator
Partner - Creator

Filetime() should give modification time ...... what you mean by alib reference ?

santiago_respane
Specialist
Specialist

Hi Rémi,

this macro will do it, but you must configure Module Security for Qv app as follows:

  • Requested Module Security: System Acces
  • Current Local Security: Allow System Access


Below the macro:

Sub PrintFileChangeDate()
  Dim strTemp
  Dim fso
  Dim fileTemp
  Dim strDate
  ' Open library of Microsoft Scripting Runtime

  Set fso = CreateObject("Scripting.FileSystemObject")
  'This is the file we want to check
  strTemp = Trim("C:\FILE_DIR\MY_FILE.xlsx")
  If (fso.FileExists(strTemp)) Then
       ' Check All files in the folder
       Set fileTemp = fso.GetFile(strTemp)
       msgbox fileTemp.DateLastModified
  End If
End Sub


Let me know if this helps.

Kindest regards,

Anonymous
Not applicable
Author

Thx all for your answers!

Actually I am litterally a newbie wtih Qlik sense. Can I use tis kind of macro directly in the Qlik script sheets?

As the FileSize() function, someone from the community said me thaht I need a lib reference tu sue the function. Unfortunately, I did not take time yet to understand well what does it mean.