Hi, I’ve been working on an automation that first fetches sheet names of two separate Excel files and then compares the content of the sheets. Now I’m in a phase where the robot picks the sheet name from collection for reading the sheet content. For some reason the Read Range activity looses part of the sheet name (the numbers) and then gives an error that the sheet “F” doesn’t exist. The sheet names are in form F0001, F0002 and so on. I have Read range set to currentItem.ToString. The current item in debug mode is correctly “F0001”. What is the issue here?
Hi @heidi.michelsson1 , is this roughly what you are doing?
Hi @sudster , yeah, something like that, but I’m using the classic Excel scope since I couldn’t get the modern working properly. Instead of giving the cell area I’m reading the whole sheet.
Hello @heidi.michelsson1,
As you mentioned you are using currentItem.ToString for reading sheets, I am assuming:
- You used Excel Scope with Get Workbook Sheets activity to generate list of sheet names
- Using the same list (list of sheets name) in for each with workbook read range activity
If above is the case then check if you are using same variable in both Excel Scope and Read Range activity for workbook path.
If your logic is different than above, a screenshot of code/xaml file would be great to further troubleshoot the issue
@heidi.michelsson1 , maybe post a few screenshots and a sample file if you can.
@sudster Here you go.
@heidi.michelsson1 , I can see multiple issues.
What is currentItem
? Why the ToString
?
It looks like you are using Workbook activity inside Excel Scope for Read Range?
@sudster I have the get sheets action working all right. I didn’t paste here the whole process, just the part I’m struggling with. So, it’s fetching the sheet names into separate collections from sheet1 and sheet2. Then I have a For each loop for checking first that the sheet names match (from collection), if yes, then I have this sequence that I pasted. I saved the current sheet name that is being processed into currentItem variable. So the idea was that in this part the current sheet from sheet 1 and sheet2 collection are read by Read range action, but for some reason it doesn’t work as it only gets ‘F’ for sheet name as it should be like F0001 and then it can’t find it. I looked from debug that everything goes fine up untill that point, so the currentItem variable has value ‘F0001’. So obviously I’m referring the Read Range in a wrong way.
@heidi.michelsson1 , I’m making a wild guess here…are you iterating over a string? For example, if you loop over “F0001”, then you will get F, 0, 0, 0 ,1
@sudster Yes! That’s it!! Geez, I feel stupid now, but this is my first actual automation, so please forgive me Thank you so much for your time and effor, I appreciate that so much!
@heidi.michelsson1 , I’m glad the issue is sorted! Please don’t feel bad, because everyone’s been there, making mistakes and learning from those mistakes.
Happy automation!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.