Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am having multiple Excel file in my specific folder. I just want to fetch all the file excel filname in my list box.
For example,
C:\Test\sample1.xlsx
\sample2.xlsx
......................
\sample10.xlsx
.......................
In my listbox, i just want to list all the file such as "sample1.xlsx,sample2.xlsx,.......sample10.xlsx".....)
file is dynamic and it should automatically load into listbox.
To get only first part of filename and get all files, not just excel:
For Each vFile in FileList('C:\Projects\*.*') Let vFileBase = SubField(SubField(vFile, '\', -1), '_', 1); Files: LOAD '$(vFileBase)' as FileName Autogenerate 1; Next
Something like:
For Each vFile in FileList('C:\Test\sample*.xlsx') Files: LOAD FileBaseName() as FileName FROM [$(vFile)] (ooxml); Next
Now use FileName in your listbox.
Thanks for your reply.
I want to trim and get only first words of every filename.
Filename will be : sample1_20190_989.xlsx, sample2_20190_989.xlsx,Test101_20190_989.xlsx,etc
So final list box would be
sample1
sample2
Test101
i am getting Script error.
Error Details below :
LOAD FileBaseName() as ProjectName
FROM [C:\projects\~$101_210_Main report.xlsx]
(ooxml)
Note : File name may be anything. so i want get all the files from the folder.
If you want to use wildcards in your filenames you can replace the "wild"-part with an *.
For example:
SET vPathFilter = '<filepath\*_specific_file_ending.xlsx';
For Each vTempFile in FileList('$(vPathFilter)')
Images:
LOAD
'$(vTempFile)' as FileName
AutoGenerate(1);
Next
Thanks..
not load the corrected script.
SET vPathFilter = '<C:\Projects\\*_.xlsx>';
For Each vTempFile in FileList('$(vPathFilter)')
Images:
LOAD
'$(vTempFile)' as FileName
AutoGenerate(1);
Next
"FileName" not loading in the listbox. i'm using wild *_ to use first word...
To get only first part of filename and get all files, not just excel:
For Each vFile in FileList('C:\Projects\*.*') Let vFileBase = SubField(SubField(vFile, '\', -1), '_', 1); Files: LOAD '$(vFileBase)' as FileName Autogenerate 1; Next
Excellent. Its working...