Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load File Name as Field in Table from XLSX

Hello-

I am trying to load multiple .xlsx files from my computer, and use the file names as a field inside of Qlik.

I need help writing the script.

deleteme1.png

Claim '....GD-01' has an open and closed (CL & OP) claim status. The reasoning in loading the file name as a field would be for users to select what file date they want for history purposes.

14 Replies
Not applicable
Author

I am adding an excel master calendar to the script. Is that a reason to not use the Year Month you mentioned?

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Sunny,

of course you're right, and I never said you couldn't accomplish the same result using FileBaseName(). (sorry about the reassignment, to me the original was perfectly ok).

Call it a nerd habit, but I always keep thinking about performance impact. Even a tiny one, like in this case. Lets compare it to how we would implement those file functions using the subfield() call. Given a full path, Filename would need a single call, while FileBaseName would need at least two. Multiplied by the number of different columns (I don't think the script engine caches the result from static calls between column creation expressions or inside a loop, but I'm not really sure) .And for no reason if you just want your specific part of the filename.

I may be nitpicking here, as the difference doesn't amount to much if you're not reading millions of lines from thousands of files.

Peter

Not applicable
Author

I just added the master calendar, and I see syn keys.

sunny_talwar

Sorry about the reassignment

No apologizes needed, I find your responses as a way to learn new things.

Call it a nerd habit, but I always keep thinking about performance impact. Even a tiny one, like in this case. Lets compare it to how we would implement those file functions using the subfield() call. Given a full path, Filename would need a single call, while FileBaseName would need at least two. Multiplied by the number of different columns (I don't think the script engine caches the result from static calls between column creation expressions or inside a loop, but I'm not really sure) .And for no reason if you just want your specific part of the filename.

So there are performance benefits here, even though they might be very slight. Is there a resource where I can read about this (and other similar performance stories?)

sunny_talwar

I don't know you data well enough to give any insights, but if you don't want to join your table on date and month fields, then don't create them