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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
chrisg
Creator III
Creator III

Log any Import

Hi,

i have to import a lot of execl-files and add some every week.

Now i want to build up a Logfile to Log the Date and filename of any import.

How can i do this

Thx

Chris

Do or Do Not. There is no try!
1 Reply
Not applicable

Here is some macro code that I use to log when data is exported, which you could adapt for your needs. It uses activedocument that obviously cannot be used in a script but you wont need to anyway - invoke your routine and pass it the details you want written to the log.

set doc=ActiveDocument

vExport = doc.Variables("vExport").GetContent.String

if vExport = "1" then


' ************ log successful export ************

vExportLog = doc.Variables("vExportLog").GetContent.String

set fso = CreateObject("Scripting.FileSystemObject")

on error resume next

set logFile = fso.GetFile(vExportLog)

if err <> 0 then ' file does not exist
on error goto 0
set logFile = fso.CreateTextFile(vExportLog)
set logFile = fso.GetFile(vExportLog)
else
on error goto 0
end if

set txsStream = logFile.OpenAsTextStream(8) ' append
txsStream.WriteLine Now & " " & vExportTo & " created by " & doc.GetProperties.FileName
txsStream.Close

end if

Regards,

Gordon