Change selector for opening different excel file names?

Hi All,

I am trying to extract data from Excel form to Sap.
However the file name of the Excel name may be different every time, but the cells and format within the excel is the same. Do I have to amend the selector for all my indicate on screen?

Example:
<wnd app='excel.exe’cls='XLMAIN’omit:title=‘ABCFORM.xlsx - Excel’ />

The validate key is in red.

I tried to change the title to ‘*.xlsx’ but it didnt work.

Thanks in advance!

Buddy @minthodology
you can use start process to open the excel files like this

  1. use a assign activity like this
    out_filepath = Directory.GetFiles(“yourfolderpath”,"*.xlsx")
    where out_filepath is variable of type array string which will have the all the excel file in that folder
  2. Now use a for each loop with the above variable as input and change the type argument as string in the for each loop property
  3. inside the for each loop use a start process activity and mention the file name input as item, a variable from the for each loop, which will have the file name of each excel
    from here on you can do any activities still being inside the for each loop

Kindly try this and let know buddy
Cheers @minthodology

Hi Palaniyappan,

Thank you for your reply. In my case, i open the excel file from outlook directly.
User may change the name of the excel. I do not save the excel in any folder.
Is there a way to recognize this excel form with random names each time?

I am currently using the Attached Window.

Yes of course we can get the attachment name and store it to a string variable like this
–get the mails from any of the mail activity and save it to a variable of type mail messages collection
–use for each loop to iterate through each mail and you can get the attachment name
Attachmentname = CType(item.Attachments.FirstOrDefault, Attachment).Name
you can use this variable any where you want where you want the attachement name to be used

Cheers @minthodology

Hi Palaniyappan,

This solution is too difficult for me :blush:
If i am to open the outlook myself… and open the excel file readily,
how can i have this excel file being recognize? can i like rename the selector to a wild name?

No Worries @minthodology
the above one is very simple
before you open any excel file in the mail attached with
pass this selector as a string to selector property
"<wnd app='excel.exe’cls=‘XLMAIN’omit:title=’ " + Attachmentname.ToString + "*’ />"

This Attachmentname will get you the name of the file attached file…in the mail

Cheers @minthodology

were you able to open now buddy @minthodology

it didnt work, i open the outlook attachment myself, not via uipath.
not sure how it can capture attachmentname of outlook…

also i tried to edit the selector to
"<wnd app='excel.exe’cls=‘XLMAIN’omit:title=’ " + Attachmentname.ToString + “*’ />”
but when i save, it will jump back to my original selector.

Hi,
i tried to use your method and on top of that… for each excel indicate on screen… i manually removed (unchecked box) for the cls and excel title and it worked.

Fine
Cheers @minthodology

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.