Not able to select an excel sheet tab correctly

Hello,

UiPath doesn’t select the designated excel sheet tab on its runtime even though I confirmed that correct selector of the tab is recognized by UiPath. It keeps selecting other sheets next to the designated one.
If you have any solution or a same issue, would you share that with me?

MS Excel version: Professional Plus 2010
UIPath version: 2016.2.6274
OS version: Windows7 Professional 64-bit

Best regards,
Pacificorca

Could you please attach the selector snapshot?

Hi

This seems to be related to a selector issue.

Please check if the control name for the sheet name in the selector is mentioned properly or not.
The selector in the attached image mentions the name “Roger” which is the name of the Sheet to be selected.

It would be easier to isolate the issue if you can share the selector.

Regards

Rajat

Thanks all.

Sorry for late reply. I attached the selector image below, so please check this out.

I erased specific sheet names for security reason, but they are wrtten in Japanese.
I implemented UiPath to select sheet2 tab, but as you can see, the red rectangle indicating selected area is not in the right position. The rectangle covers just right part of sheet2. I confirmed XML infromation as well and the information was correct.
evidence

Best Regards,
Pacificorca

Hi,
how about set the cursor offset(X/Y) value and position.
cursor

well you can use hot keys as well if you know where that sheet will always come…

Move to the next sheet in the workbook - CTRL+PAGE DOWN

Move to the previous sheet in the workbook - CTRL+PAGE UP

Regards…!!
Aksh

Thanks for quick response.

Actually, I tried your solution before and it seemed to work.
Still, I’m just wondering why this happens in my environment since I’ve believed selectors can click what I select.

Thanks.

well is it reliable to depend on coordinates? screen resolutions might change :slight_smile: on system to system and if excel will open in a minimize state then these coordinates will work?. hot key will generate the same thing :slight_smile:

What if sheet name moved its position from 2nd to 4th :stuck_out_tongue:

that is rare. you know the template and can fixed it as your requirement or prerequisite.

Jai ho :rofl:

that is rare. you know the template and can fixed it as your requirement or prerequisite.

and one more thing you can take the all excel sheets name and then can decide at what number it is coming then you can fire that many times your hot key :slight_smile: :wink: :sunglasses:

Note: just have to make sure your active sheet always should be sheet1 so you can go forward :stuck_out_tongue:

As usual, a very late comer to the topic folks! But I will post this solution here so that it may help someone like me.

Issue: A click activity with the Selector does not work reliably!
But a Find Element followed by a Click seems to identify the correct worksheet tab!

At least in the latest version of office you can achieve this in two separate steps.

Step 1: Use the Find Element to identify a tab in the Worksheet. The selector looks overwhelming like so:

image

<wnd app='excel.exe' cls='XLMAIN' title='ReportName*' />
<wnd cls='XLDESK' />
<wnd cls='EXCEL7' title='ReportName*' />
<ctrl name='ReportName*' role='client' />
<ctrl name='Sheet Navigation Bar' role='client' />
<ctrl name='Sheet Tabs' role='page tab list' />
<ctrl name='Incident Info' role='page tab' aastate='moveable, selectable' text='Incident Info' />
  • Note that I’ve replaced the name of the Excel throughout with a Wild card called ReportName* to make a generic selector.
  • The last line of the selector is important as it will be used to parameterize the tab name as well!

Problem Statement:
I need to delete a tab named “Incident Info”.

Important: As seen from the screenshot above the tab I want to delete is not the tab in active focus!

Next, get the Find Element result into a UiElement Variable say, wbTab

Then, use the Click Activity and pass the UiElement to it as the Target .

image

Run your Sequence and it should work. You will see that the Robot will switch focus to the Worksheet you want to delete and make it the active worksheet.
Once you have the active worksheet, you can use hot keys:

  1. Alt + H (home)
  2. d (delete)
  3. s (sheet)
  4. If worksheet has data, a Delete confirmation button needs to be clicked - else this can be skipped
  5. Ctrl+s to save your changes

The Killer test:

  1. Move the worksheet you want to delete to the very ends of the list of tabs.
  2. If your robot can select them correctly at the ends, then you have a reliable solution!

I will try to use a fake worksheet and post code here. Until then, give this a shot!

1 Like

And here it is! This works reliably each time based on my test.

The Fake Excel file has different tabs in it - some with data, some empty and one tab with a space in its name
The sequence contains an array of sheet names and they are not in any specific order!

Demo 1 of 2: Will simply loop through the array of sheets and correctly select the tabs in the Excel

Demo 2 of 2: Will do the same thing as Demo 1, but will delete each tab and skip the default tab Sheet1

I have a 2 second pause between each action so that this thing is comfortable to follow.

Hope this helps others. I have a requirement to build an attended automation and the Robot owner will need to visually see the operation in progress. Therefore, this approach has been a tremendous help for me in my project!

Make sure that your sequence can access the Sample Excel.

ReportName-123456.xlsx (16.7 KB) Test_Delete_ExcelSheet.xaml (28.0 KB)

@AndyMenon thank you very much! This worked perfectly for me.

Best regards,
Ken

Excellent @kchang :slight_smile:

I’m glad you have progress on your project. Please do mark the post as solution so that other members may find it helpful and also close this post.

Cheers! :+1:

Ah…yes, will do.

Hi Andy, I don’t see a solution so I can mark it as such. Sorry.

1 Like