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 26, 2018 in Selenium by nitinrawat895
• 10,950 points
3,755 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 26, 2018 by nsv999
• 5,510 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
8,704 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,510 points
3,516 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

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

answered Aug 31 in Selenium by Sri
• 2,970 points
4,520 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,890 points
2,589 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 2 in Selenium by Sri
• 2,970 points
2,844 views
0 votes
1 answer
0 votes
1 answer