Automate Data Entry with Chrome Using Excel Macros

Published 2021-12-07
How to automate data entry with Chrome using Excel macros and Selenium. Details available at www.exceltrainingvideos.com/automate-data-entry-wi…

Here's the complete VBA macro code:
Option Explicit
Dim driver As New WebDriver
Sub Test()
Dim keys As New SeleniumWrapper.keys
driver.Start "chrome"
driver.Get "\"

driver.Window.Maximize

driver.Wait 1000
driver.FindElementById("State").Click
driver.FindElementById("State").SendKeys Sheet1.Cells(2, 1).Value

driver.Wait 1000
driver.FindElementById("District").Click
driver.FindElementById("District").SendKeys Sheet1.Cells(2, 2).Value

driver.Wait 1000
driver.SendKeys (keys.Enter)

driver.FindElementByName("RespondentAge").SendKeys Sheet1.Cells(2, 3).Value
driver.Wait 1000

driver.FindElementByName("RespondentName").SendKeys Sheet1.Cells(2, 4).Value
driver.Wait 1000

driver.FindElementByName("RespondentMobileNo").SendKeys Sheet1.Cells(2, 5).Value
driver.Wait 1000

driver.FindElementByName("RespondentGender").Click
driver.Wait 1000
driver.FindElementByName("RespondentGender").SendKeys Sheet1.Cells(2, 6).Value
driver.Wait 1000

driver.FindElementByClass("btn-primary").Click
'driver.SendKeys (keys.Enter)

driver.FindElementByName("FQ1").Click
driver.FindElementByName("FQ1").SendKeys Sheet1.Cells(2, 7).Value
driver.Wait 1000

driver.FindElementByName("FQ2").Click
driver.FindElementByName("FQ2").SendKeys Sheet1.Cells(2, 8).Value
driver.Wait 1000

driver.FindElementByName("FQ3").Click
driver.FindElementByName("FQ3").SendKeys Sheet1.Cells(2, 9).Value
driver.Wait 1000

driver.FindElementByName("FQ4").Click
driver.FindElementByName("FQ4").SendKeys Sheet1.Cells(2, 10).Value
driver.Wait 1000

driver.FindElementByName("FQ5").Click
driver.FindElementByName("FQ5").SendKeys Sheet1.Cells(2, 11).Value
driver.Wait 1000

driver.SendKeys (keys.Enter)

End Sub

All Comments (21)
  • nice content Dinesh Kumar Takyar. I crushed the thumbs up on your video. Always keep up the excellent work.
  • You are always awesome sirπŸ‘πŸ»πŸ‘πŸ»πŸ‘πŸ»πŸ‘πŸ» thank you for the video
  • @excelrobot
    Love it, I have a project I can use with this right away.
  • Wonderful video Sir could you please make a video on how to automate data input in a past disabled date picker using selenium and excel VBA? It would be a great help. Thanks in advance.
  • @ednedn2326
    Thanks for your video, but sir if i have a button to "browse" for a file and a button to "upload" the file, how to handle this? Thanks again.
  • But sir if your data has multiple rows then...? How will you autofill that data?
  • @xrman3459
    Hello Mr. Daniesh Kumar Takyar, I knew that to fill elements with sendkeys, but how to fill web elements with paste or keys Control + V , ( on chrome, vba, selenium )
  • @dd1965
    Hello. Very nice, thank you for sharing tips. What about web page based on javascript ? could you please post a video to find fields and to take control ?
  • Sir apka video dekha bohot help full h. Mujhe kuch clear krna h apse agar kisi website ko auto fill krte h to us par auto fill nhe kr pate to uske liye koi hisab h jisse ji ham auto fill kr le or software usko detach na kar pae. Plz agar esa hota h to mujhe btao sir plz help.
  • @temokater1813
    Thanks alottt but how can i repeat this task yo do multiple rows ????? Can u help me please
  • @keepitsimple7394
    It is filling the form sequentially. do you know they way to fill all the column at one go
  • hello ive a query that how to repeat this task.. lets say I have 1000 entry and want to out it on web so how can do that?
  • @VamTheWarlLock
    Hello Sir, I did the coding as you mentioned in your Video but i m stuck on a page where i neet to enter an OTP for the proceedings though have another problem that i have select a particular Phone no. And then wait for the OTP. BUT the problm is when i dirct to that page and select the radio button for selection of Phone no. It shows me the "Out of Memory" error. I gusse its hard to get time for these kind of requsts but its will be really appreciated Sir if we can connect over Email or Whatsapp for my query. Though thanks a lot for helping us out with this Great code. πŸ‘ πŸ˜‡