Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi friends,
i am creating a Report using last two years data.
here my problem is am having the source files in daily basis and storing in different folders date wise.
i have to extract all , i have to take one by one? or is there any better way to extract all these files?
suggest me please...
thanks,
sowmya
Try this,
Sub ScanFolder(Root)
For Each FoundFile in Filelist( Root & '\*' & '.xlsm')
If '$(FoundFile)' Like '*Stratification Audit*' Then
Data:
Load *,
Subfield('$(FoundFile)','\',SubStringCount('$(FoundFile)','\')+1) as FileName
FROM [$(FoundFile)] (ooxml, embedded labels, header is 8 lines, table is [Stratification Audit]);
End If
Next FoundFile
// Sub folder
For Each SubDirectory in Dirlist( Root & '\*' )
Call ScanFolder(SubDirectory)
Next SubDirectory
End Sub
Call ScanFolder('P:\Banking\03 Reporting\Source Files\QRM Output\2016') ;
my folder structure:
D:\ Report \Sensi \Archive \Archive(YYYYMMDD) \IR Dump \myfile.csv
hi, i am getting the above error, my code is below.
SUB scanfolder(root)
for each fileextension in 'xlsm'
For Each FoundFile in Filelist( Root & 'P:\Banking\03 Reporting\Source Files\QRM Output\2016\*\*\*Stratification Audit Report v2.xlsm')
if WildMatch('$(FoundFile)','*Stratification Audit*') then
Data:
Load *
FROM [$(FoundFile)] (ooxml, embedded labels, header is 8 lines, table is [Stratification Audit]);
ENDIF
Next FoundFile
Next FileExtension
// Sub folder
For Each SubDirectory in Dirlist( Root & '\*' )
Call ScanFolder(SubDirectory)
Next SubDirectory
End Sub
Call ScanFolder('P:\Banking\03 Reporting\Source Files\QRM Output\2016') ;
Try this,
Sub ScanFolder(Root)
For Each FoundFile in Filelist( Root & '\*' & '.xlsm')
If '$(FoundFile)' Like '*Stratification Audit*' Then
Data:
Load *,
Subfield('$(FoundFile)','\',SubStringCount('$(FoundFile)','\')+1) as FileName
FROM [$(FoundFile)] (ooxml, embedded labels, header is 8 lines, table is [Stratification Audit]);
End If
Next FoundFile
// Sub folder
For Each SubDirectory in Dirlist( Root & '\*' )
Call ScanFolder(SubDirectory)
Next SubDirectory
End Sub
Call ScanFolder('P:\Banking\03 Reporting\Source Files\QRM Output\2016') ;
Thanks Tamil.. its working
My pleasure Sowmya. Have a good day.