How to copy paste some information to website using loop with switching between browser and excel?

I have a list of data in a spreadsheet. I want to perform some search query with my opened website. But I wasn’t able to switch between excel and browser.

For eg.
1] open website [Open Website]
2] get require text boxes xpath value. [some xpath values]
3] open spread sheet [Open Spreadsheet]
4] get value from A2 cell value [Get Cell Value]
5] Switch to browser [Switch to Browser]
6] Past value from variable on my browser [Web Element]

That above steps working fine with my example.

Now I want to save website result on my excel cell like B2 and copy another A3 cell value to my browser.
For that I wasn’t able to switch from my browser to excel. If I used Window Action library for switch window then i couldn’t put Get Cell Value inside window action.

Please help me for that

Were you using excel actions within Recorder to open Excel? If you were then you can’t switch windows the way you describe.

In this case I can think of two options:

  1. Open Excel natively in recorder and use the Application - Window to switch between the two as needed
  2. Put your results into a list variable as a temporary storage then write them to Excel in one go when finished in the browser.

I prefer option one here as it is easy to get lost in lists and paste the data to the wrong place.

My actions as per above image.
I copied G2 cell value from my excel and paste to my browser but there is no option to put it inside my open spreadsheet Action library tree.

So i take another Action Library tree Switch Browser and try again. it’s work with paste my G2 cell value into opened website memberid’s xpath value. now again same issue occured, how i copy another data from excel. need to switch again with my excel sheet.


I don’t think this approach will work reliably. The web actions and spreadsheet actions terminate on completion so you can’t swap over and back reliably between them.

I think you will have to open a browser (eg with Win+R or something) and also your spreadsheet (Win+R “path to your excel file” (remembering the quotation marks)) and then swap between the two.

That has other disadvantages in terms of selecting items with xPaths but you may be able to find a way around that…

1 Like

@vishal_bareja why don’t you read the whole column A, save to a list, set active call to B2 and then iterate through this list using For Each loop (with filter 2-*):

  • set the value on the webpage using Web element
  • get the resulting value and append it to another list variable

After all cells from column A have been processed, you will have a list variable with all the results from the webpage. Then you can open Excel and set set each value from the results list variable using For Each loop.

This way you will not have to switch between windows, and the excel actions will be performed in the background faster.

That’s my “Option 2” from above - just make sure you write blanks to the list if necessary and make sure that the write backs start at the same place. It is easy to get lost with this approach!

1 Like

Yes, exactly, you have to make sure you write the data back to correct cells.