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: 
JohnSamuel123
Creator
Creator

Saving each txt file as a csv

hi,

i have a report that pulls in any txt file from a specific file location, parses out the relevant data and then displays it. currently its configured to then store the information into a csv.

however, i now need it to save a csv for each txt file it reads in and to keep the original name.

so in my folder i will have txt file: A, B, C..

do i need to do something like 

"for each FolderName in ('\\folder\*.txt')
for each File in filelist (FolderName)

details:

load * from '\\folder\*.txt'

;

Store...? into [csv] (txt);

how do i get Qlik to save a csv for each txt file it reads in and keep the name? do i need to do a loop to grab a txt file one at a time?

any help would be appreciated

thanks

11 Replies
JohnSamuel123
Creator
Creator
Author

hi @rwunderlich 

i have updated the vBasename, for $(vfile) i use a  user lower case f so i dont think thats the problem. i think im having an issue with saving them as csvs. when i run it, it saves the csvs as one file with the file name '':

JohnSamuel123_0-1633679317545.png

 

i think this is because its not picking up my vBaseName for some reason?

JohnSamuel123_2-1633679383324.png

 

JohnSamuel123_1-1633679363771.png

 

JohnSamuel123_4-1633679700624.png

 

not sure whats causing the issue here.

 

thanks again

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Look at the log. You are using a name of '' in the Store statement. 

1. You don't need the 

let vfile = replace....

statement any more.  It does nothing for you. 

2. Because you spelled it "vfile" in the for each, your 

let vBasename = SubField(SubField('$(vfile)', '\', -1), '.', 1);

must spell vfile the same way. 

-Rob