Alex Elfont
Alex Elfont

Reputation: 125

Using Python to get Excel data and fill form

I have an excel sheet with data I'd like to input into boxes on a web form.

import pandas as pd
df = pd.read_excel('C:\\Users\\jj\\Documents\\python_date_test.xlsx', Sheet_name=0)
(df['bx1'][0])

The output of the above code is '2'

When I insert this code into the code I'm using to webcrawl, I get the following error 'TypeError: object of type 'numpy.int64' has no len()'

Here's the code that produced this error:

mea1 = browser.find_element_by_name("data1_14581")
mea1.click()
mea1.send_keys((df['bx1'][0]))
mea1.send_keys(Keys.TAB)

mea1 refers to the first box for user input.

How can I get the value of (df['bx1'][0]) and enter it in to the box?

Upvotes: 2

Views: 462

Answers (1)

Pete Breslin
Pete Breslin

Reputation: 111

I haven't used this package but looking at it I believe you are on the right track, try changing the code to:

mea1.send_keys(str((df['bx1'][0])))

Upvotes: 1

Related Questions