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: 
chrisg
Partner - Creator III
Partner - 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