TypeError: object of type 'float' has no len() Error while reading data from Excel in Robot Framework.

554 views
Skip to first unread message

Swathi Vegesna

unread,
May 23, 2017, 8:23:02 AM5/23/17
to robotframework-users


 Hi,

  While Reading the data from Excel, I am getting the TypeError: object of type 'float' has no len()  Error  . So not able to input the data from the Excel.

I am trying to read  the data  “5178” from the excel, then I am getting the error.

If I put  “51” then  able to read the data successfully.

 

Below is the code.

*** Settings ***

Documentation     This function is to read the data from Excel

Suite Teardown    Close Browser

Library           Selenium2Library

Library           OperatingSystem

Library           ExcelLibrary

 

*** Test Cases ***

Read Data From Excel

    Open Browser    https://google.com    googlechrome

    GoogleLogin

 

*** Keywords ***

GoogleLogin

    Open Excel Current Directory    TestExcel.xls

    ${searchitem}=    Read Cell Data By Name    TestSheet1    B3

    Input Text    name=q    ${searchitem}

 

So could you please help me in resolving issue.

Below are the versions I am using.

Python: 2.7.13

Robot Framework: 3.0.2

Excel Library: 0.0.2


 

SampleTest.zip

Kalyan Singh

unread,
May 30, 2017, 8:52:58 AM5/30/17
to robotframework-users
Hai swathi,


             Open Excel Current Directory    TestExcel.xls

    ${searchitem}=    Read Cell Data By Name    TestSheet1    B3

    Input Text    name=q    ${searchitem}



         i suggest you to use below code


                            Open Excel Current Directory    TestExcel.xls

                      ${searchitem}=    get column values    TestSheet1    0 (0 is the first column 1 is 2nd column and so on....)

                      Input Text    name=q    ${searchitem[0][1]}            ([0][1] [1][1] [2][1])


 get column value gives all column values

Swathi Vegesna

unread,
Sep 15, 2017, 10:22:22 AM9/15/17
to robotframework-users
Hi Kalyan,

In the Excel file, I have made that cell as Text format and  given ' before the number. After this I am able to read data from Excel without any issues.

Snehal Bhosale

unread,
Feb 16, 2018, 4:49:51 AM2/16/18
to robotframework-users
Hi Swati,

Please share the whole code, as am getting same error.
I have already changed cell format as text, still i am getting same error.

Thanks,
Snehal

ABHISHEK KUMAR

unread,
Nov 29, 2018, 5:56:16 AM11/29/18
to robotframework-users
hey Swati, excellent piece of information by you. Thanks a lot it worked for me :)


On Tuesday, May 23, 2017 at 5:53:02 PM UTC+5:30, Swathi Vegesna wrote:
Reply all
Reply to author
Forward
0 new messages