I have excel file to read, the sheet name is using Month, but have 4 different format, for example the sheet name can using MMMM format in english August, or MMM format in english Aug, but also can using Indonesian MMMM format Agustus, or Indonesian MMM format Agt, How can I read the file without caring about the sheet name as long as it is the correct month,
This is example for the month mapping.
Thank you and have a nice day!
Hi
Welcome back to UiPath forum
I believe this we can achieve with few retries
Hope the below steps would help you resolve this
First create a assign activity and mention like this
arr_month = {Datetime.Now.ToString(“MMM”), Datetime.Now.ToString(“MMMM”), Datetime.Now.ToString(“MM”)}
Where arr_Month is a variable of type array of string
-
Use a Retry scope activity and mention the number of retries as 4 in the property panel
-
Then use a assign activity inside the action block and mention as
counter = 0
Where counter is a integer type variable -
Then use a READ RANGE activity and to read the workbook where in the sheetname mention like this arr_month(counter).ToString
-
Then mention the other properties like filepath and get the output as a datatable u want
-
Finally within action block use a assign activity like
This
Counter = counter + 1
Cheers @Hendaryie_Tjoeng
But how about the format of the month? It can be Indonesian or English format
You need to read only one sheet or many sheets?
And you dont know the sheet name which you want to read the sheet?
- If you have only one sheet then you can use sheetnumber also to read the excel or use for each sheet activity and read the sheet as it is only single
- If you have multiple and based on month if you need to read…then also use for each sheet in excel or get sheets activity from classic and match the sheetname with the possible month names datatable and then read the sheet …for that you can use a filter datatable with months datatable as input and then filter would be 0 equals currentsheetname ,1 equals currentsheetname and so on for all coloumns with or condition…then if it matches atleast one read the sheet else move forward
Hope this helps
Cheers
Got it
So instead of we formulating the sheetname we can let the bot get it
Use GET WORKBOOK SHEETS so that it gives u the list of worksheets in an excel file
https://docs.uipath.com/activities/other/latest/productivity/excel-get-workbook-sheets
cheers @Hendaryie_Tjoeng
i want to read 1 sheet, the name of the sheet is in the excel title, but can be different, for example, in the title, the month is Aug, but the sheet can be August
then I would recommend to get the sheetnames first and then use them to read specific sheet
reason being the sheetname might be of any format
Please try using the above logic…that would get you all the possible values and then you can check the sheetname with comparing it
cheers
I will test this, Thank you for the answer!
sounds great, i will give it try, thank you for the answer!
i’ll give it try, thank you!