Saving data to the same xls file with Robot Framework ExcelLibrary

0 votes

Is it possible to read data and write data to the same .xls file with Robot Framework? Below is my code. Error is in the final line.

Library  Collections
Library  ExcelLibrary

*** Test Cases ***
Write Results to Excel
    Open Excel  ${Excel_Path_Of_File}${Excel_Name_Of_File}

    # Check to see if the Results sheet exists before creating:
    ${sheetNames} =  Get Sheet Names
    ${SheetChk} =  Evaluate  ${EXCEL_RESULTS_SHEET}  in  ${sheetNames}
    Run keyword If  "${SheetChk}" == "False"
    ...  Add New Sheet   ${EXCEL_RESULTS_SHEET}

    # Write the data
    Put String To Cell  ${EXCEL_RESULTS_SHEET}  ${ColNo}  ${RowNo}  ${ResultsDataVal}

    # Save the data
    Save Excel  ${Excel_Path_Of_File}${Excel_Name_Of_File}
    # Getting error: ValueError: dictionary update sequence element #0 has length 8; 2 is required
Mar 27, 2018 in Selenium by nitinrawat895
• 11,380 points
6,717 views

1 answer to this question.

0 votes

The documentation of the library states that, do not perform any opeartions before or after adding a sheet in its "Things to Note When Using robotframework-excellibrary" section:

When using the keyword Add New Sheet the user cannot perform any functions before or after this keyword on the currently open workbook. The changes that other keywords make will not be saved when the keyword Add New Sheet is used.

To overcome this, in the Run Keyword If fragment, you have to also save the file, and re-load it

answered Mar 27, 2018 by nsv999
• 5,500 points

Related Questions In Selenium

0 votes
1 answer

How to handle the popup of file upload in Windows OS with WebDriver?

The value of name locator has probably ...READ MORE

answered Apr 25, 2018 in Selenium by king_kenny
• 3,710 points
18,558 views
0 votes
1 answer
0 votes
1 answer
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,726 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,167 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,244 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,885 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP