Hi all,
problem:
i wish to read a single sheet from each files with path:-
C:\Users\user\Documents\testenviroment\test_20190715_1220.xlsx
C:\Users\user\Documents\testenviroment\test_20190714_1420.xlsx
C:\Users\user\Documents\testenviroment\test_20190713_1020.xlsx
.
.
.
C:\Users\user\Documents\testenviroment\test_20190715_0820.xlsx
20190715 is about yyyy,mm,dd
0820 is about time now
time now is the one i wish to wildcard, which no algorithm, or tracking part can be used to track it.
for example, in read file, with path “C:\Users\user\Documents\testenviroment\test_todayDate_*.xlsx”
to me, is failed with reason
any solution or suggestion?
2 Likes
venkat4u
(venkat)
July 15, 2019, 4:13am
2
Hi @damonyl ,
you can not use wildcard in file path.
what is your requirement can you elabarate much more. So we can help
lakshman
(Ganta lakshman)
July 15, 2019, 4:13am
3
@damonyl
We can’t use wildcards in reading file.
Try this way.
strExcelFiles [] = Directory.GetFiles("C:\Users\user\Documents\testenviroment\","test*.xlsx")
The above expression will read all matching files and will give output as string array. Then use For Each loop activity to read one by one file.
10 Likes
Hi @lakshman , so which activity should i run for this code? assign?
lakshman
(Ganta lakshman)
July 15, 2019, 4:21am
5
@damonyl
use Assign activity and create one variable of type string array and say strExcelFiles
1 Like
@lakshman will try this. By the way, i have update my post and more precise. please have a look
1 Like
@venkat4u , try check if you understand my post now. i have update the problem facing
lakshman
(Ganta lakshman)
July 15, 2019, 4:28am
8
@damonyl
My expression will work for you and just try once.
@lakshman
I’ve tried put it in assign , it turns up
lakshman
(Ganta lakshman)
July 15, 2019, 4:41am
10
@damonyl
It should be like this:
Directory.GetFiles("R:\Phil\DB Specifications\", ReportName.Tostring+"_"+Now.Tostring("yyyyMMdd")+"_"+"*.xlsx")
6 Likes
@lakshman got it! thanks! so the comma will be before folder name. thanks again!
1 Like
system
(system)
Closed
July 18, 2019, 4:55am
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.