Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I'm new on this community and therefore my question may have been already asked.
The application I'm developping requires to reload automatically a file with a name that change every day. :
Today the filename would be: "20140205_two.csv", tomorrow it will be "20140206_two.csv" as you can see the name in depending on the date.
The script that I want to include should reload the correct file depending on the current day.
Thank you in advance.
Let vFile = date(today(), 'YYYYMMDD') & '_two.csv';
YourTable:
LOAD *
FROM $(vFile);
Instead of file name you can write "*_two.csv"
You could use the following syntax :
for each file in filelist(????????_two.csv)
load
*
from $(file)
please check syntax, this is just an example
Let vFile = date(today(), 'YYYYMMDD') & '_two.csv';
YourTable:
LOAD *
FROM $(vFile);
Example Given Below...
Instead of this
LOAD Column1,
Column2
FROM
(ooxml, embedded labels, table is Sheet1);
Please use like this
LOAD
abc,
def
FROM
[C:\Documents and Settings\Ashwani\Desktop\2014*.csv
(ooxml, embedded labels, table is Sheet1);
See i have used ' *' due to this qv will load all the csv files starting with 2014. Now date change does not impact you.
If it not works then please let me know.
Your answer is exactly what I asked for but I have another issue the real name is:
"20140204_two_201402051420114745.csv" (the last numbers can be assimilated as randomised) I pretentiously thought I could used your answer and modify it like this:
" Let vFile = date(today()-1, 'YYYYMMDD') & '_two' & '*.csv'; "
I tried to use the star without the quotes, with a "\", or after the FROM but each time I failed.
Thank you very much
Try like this:
Let vFile = date(today(), 'YYYYMMDD') & '_two_';
YourTable:
LOAD *
FROM $(vFile)*.csv;
Thank you so much!
It exactly what I was looking for.
I'm glad it works for you!