RPA.Cloud.Google - Update Values example

Example is built with rpaframework 9.1.0

*** Settings ***
Library           RPA.Cloud.Google
Library           Collections
Library           Dialogs
Suite Setup       Init Sheets Client    service_account.json

*** Variables ***
${SHEET_ID}       1PM84VrlRWlepeaIxt....
${SHEET_RANGE}    Sheet1!A1:F10
${CLEAR_RANGE}    Sheet1!E2:F10

*** Tasks ***
Minimal task
    ${sheet}    Get Values    ${SHEET_ID}    ${SHEET_RANGE}
    ${values}    Set Variable    ${sheet}[values][1:]
    FOR    ${row}    IN    @{values}
        ${numbers}=    Evaluate    [item for item in ${row} if isinstance(item, int)]
        ${sum}=    Evaluate    sum(${numbers}[:4])+5
        Set List Value    ${row}    4    ${sum}
        Set List Value    ${row}    5    XVALUE-${sum}
    ${response}=    Update Values    ${SHEET_ID}    ${SHEET_RANGE}    ${sheet}[values]
    Log Many    ${response}

Sheet before update:

Sheet after update:

1 Like

Ping @tommi: I guess you were looking for a way to do these range updates? Now you can! :slight_smile:

1 Like

So you are using Set List Value to set the 4th and 5th position of each row (corresponding to E & F cols), and then simply update the entire row back. Iā€™m assuming ${CLEAR_RANGE} variable is not needed at all actually?

Thanks for the example!

I got it to work, but not with Set List Value (the indexes are out of bounds), but with Append To List.

Updated example in Github:

1 Like