please provide some idea for next situation:
I will download excel files. I do not know name of files, name of sheet and how many columns will be in those files. I should check if files contain some key word in any columns inside.
Thank you for support and ideas!
use the below code to get the download path and store it into string variable(strpath)
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)+"\Downloads" **or** Environment.ExpandEnvironmentVariables("%USERPROFILE%\Downloads")
use Excel Application scope to read the sheet. (Refer the below path how to get the sheet names)
I have a solution for y’all.
First, install this package.
ExcelActivities.1.0.18.nupkg (9.5 KB)
Second: open this xaml and set up the path to an excel workbook with more than one sheet.
Readsheetname.xaml (7.7 KB)
Please, please comment your findings on this.
Yes you can.
Use excel application scope activity ,
create output variable from the property called workbook(eg:wb)
To see the sheet name just use write line and pass like this wb.GetSheets(0).
Then use Read range and in the sheet pass like this wb.GetSheets(0).
PS: make sure to use that outside the excel scope(means you need to add one more excel scope and use read range there)
Then use Read Range to get the data from the excel.
Can some one please explain what does (0) at the end of the above Expression mean?
I tried the code without (0) and it would not let me assign it to a String variable since it was Expecting a String
i used (0) then and it resolved the issue.
Your Explanation on this will be very valuable.
Thanks in Advance!
Directory.GetFiles will return the value of array.
Here (0)-> it’s means first value of the array value.
(0)-> it means the first sheet.
Thankyou for your Explanation!
That was very helpful. It Resolved my query and now i understand it just perfect.