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,030 points
1,440 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,050 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,590 points
2,202 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Need to control the file download dialog box in Mozilla Firefox

Well for Firefox, there is something called ...READ MORE

answered Apr 20, 2018 in Selenium by king_kenny
• 3,590 points
115 views
0 votes
1 answer

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,050 points
256 views
0 votes
1 answer
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,130 points
621 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
249 views
0 votes
1 answer
0 votes
1 answer