Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Friends
I am thanking you for your time.
I have multiple xls files as under
GL20131031.XLS
GL20130930.XLS
.
.
GL20130430.XLS
How do I select file which has max date in file name(in this case GL20131031.XLS) at script level?
Thanks
Try below in your script
=======
FileName:
LOAD
FileName() as FileName,
Date(Date#(MID(FileName(),3,8),'YYYYMMDD')) as Date
FROM
*.xlsx
(ooxml, embedded labels, table is Sheet1);
TempMaxDate:
Load
Max(Date) as MaxDate
Resident FileName;
Let vMaxDate = Date(Peek('MaxDate',0,'TempMaxDate'),'YYYYMMDD');
Drop Tables FileName, TempMaxDate;
TableName:
LOAD
*
FROM
Sales$(vMaxDate).xlsx
(ooxml, embedded labels, table is Sheet1);
=======
Only Helpful ?
Is there anything missing?
Your script is loading the filenames from a spreadsheet and I think what Satish wanted was to get the filenames from the folder using a filelist
Eduardo
OK... Got it...
Use as Below
======================
TempFileName:
LOAD
FileName() as FileName,
Date(Date#(MID(FileName(),3,8),'YYYYMMDD')) as Date
FROM
*.xlsx
(ooxml, embedded labels, table is Sheet1);
NoConcatenate
Final:
Load
*
Resident TempFileName
Order By Date Desc;
Drop Table TempFileName;
Let vFileName = Peek('FileName',0,'TempFileName');
==================================
Use vFileName variable as your result...
I think that the script appendend to this message answers your need to load the newest excel file of a folder.
Unfortunetly, I don't know how to paste the text in this message.
Let me know if this is what you was looking for.
Eduardo