cancel
Showing results for 
Search instead for 
Did you mean: 

Cant choose rows in excel to delete

HeleneKnox
Level 3
Hi!
I am new to Blueprism so maybe my question seems easy but I cant seem to choose which rows in an excel document to delete. What I have done through MS Excel VOB first
1. create instance, where the output is an excelhandle
2. OpenExcelworkbook with the above excelhandle and the fullpath including xlsx
3. Activate worksheet (do I need this, only have 1 worksheet)
4. then I read excelfile and put that into an collection
5. find out how many rows the collecition
6. Copy file to done and rename 
SO far everything works
7. select rows where I have the excelhandle from #1, the same path as in 2 for workbook, the name for the worksheet and then for cell reference I use number:number but i get the following error message
"failed to select row, not valid index (/exception from Hresult....)

anyone know what I am doing wrong?

1 BEST ANSWER

Helpful Answers

Hi @Helene Knox,

I think the issue might with how you are renaming the file there in step #6 as if you do that Workbook Name may no longer be recognized. Ideally, my suggestion would be to follow either of the below two approaches:

1) First, you close the file and instance once you are done saving the file as the new renamed file. Once, instance is closed successfully provide some minor delay using wait stage and then again open a new instance and newly renamed excel file. Then, you use the Delete Row(s) action with all the new parameters used during this handle.

2) Otherwise, the second approach would be that you first delete the rows in excel using Delete Row(s) as soon as you determine what all rows you need to delete from collection. Once the rows are deleted, then you save the file as the renamed file. This is a much cleaner approach since we do everything within the original handle that was created. Since from your steps, it looks like there are no changes that need to happen in the original file hence, the changes only need to be reflected in your renamed file.

Also, you don't need Activate Worksheet action before using Delete Row(s) action.​ It should work directly.

------------------------------
----------------------------------
Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
WonderBotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

View answer in original post

1 REPLY 1

Hi @Helene Knox,

I think the issue might with how you are renaming the file there in step #6 as if you do that Workbook Name may no longer be recognized. Ideally, my suggestion would be to follow either of the below two approaches:

1) First, you close the file and instance once you are done saving the file as the new renamed file. Once, instance is closed successfully provide some minor delay using wait stage and then again open a new instance and newly renamed excel file. Then, you use the Delete Row(s) action with all the new parameters used during this handle.

2) Otherwise, the second approach would be that you first delete the rows in excel using Delete Row(s) as soon as you determine what all rows you need to delete from collection. Once the rows are deleted, then you save the file as the renamed file. This is a much cleaner approach since we do everything within the original handle that was created. Since from your steps, it looks like there are no changes that need to happen in the original file hence, the changes only need to be reflected in your renamed file.

Also, you don't need Activate Worksheet action before using Delete Row(s) action.​ It should work directly.

------------------------------
----------------------------------
Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
WonderBotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.