Hi, i want to ask. is it possible to read an csv file with dynamic names ?
in my case, i need convert the csv into excel, but the file names is different each day.
ex :
filename_object_yy-mm-dd.csv
animal_cat_22-04-12.csv
the filename_object is same, but the yy-mm-dd is different eachday
because i download the files eachday in morning.
i hope you guys understand ( sry for bad english )
thanks
1 Like
Hey @Nur_Alif_Irawan
You already have the answer, just pass the filename dynamically into the activity property.
I’m just assuming it will be the current day’s date.
"filename_"+Now.ToString("yy-MM-dd") + ".csv"
Hope this helps
Thanks
#nK
hi, how to do that ?
i mean how to add the expression
1 Like
Hey @Nur_Alif_Irawan
Let’s say you are using Read CSV activity and passing path to it in one of the activity property.
Just pass the below,
<folderpath> + "filename_"+Now.ToString("yy-MM-dd") + ".csv"
Hope that helps
Thanks
#nK
awesome, i’ll do that and tell you if works
1 Like
i got problems, they said could not find the file.
is my expression is right ?
1 Like
i know the problems,
the file month is 4 instead 04.
how to get the 4 without zero ?
1 Like
i remove the first M, and its works.
but i wonder how about month in 10, 11 , 12 ?
because i remove the first M
1 Like
It will be auto handled no worries with single M.
Thanks
#nK
Hi @Nur_Alif_Irawan,
If you are downloading and using it then you can get the latest downloaded file from the download folder. Please see the below expression. (Expression will return you the file path.)
Directory.GetFiles(yourfolder_path,"*.txt").OrderByDescending(Function(d) New FileInfo(d).CreationTime).Tolist(0)
You are using it to extract the data then you don’t need to pass the dynamic name you can simply do it in above way.
If you want the file name for other purpose then do it as suggested by @Nithinkrishna
Thanks!
1 Like