Using Google Sheets

To use Google Sheets with rpaframework you need to install package with extras. The reason why Google is not part of the main rpaframework package is the size of Google dependency packages.

Sheets support exists from rpaframework version 5.1.0 onwards.

Installation can be done in conda.yaml

channels:
  - defaults
  - conda-forge
dependencies:
  - python=3.7.5
  - pip=20.1
  - pip:
      - rpaframework[google]

Or just with pip install -U rpaframework[google]

Google Sheets usage example using service account json file:

*** Settings ***
Library   RPA.Cloud.Google

*** Variables ***
${SHEET_RANGE}   Sheet1!A1:A50
${SHEET_ID}      f373443r3t34ttt34t34ttg

*** Tasks ***
Inserting values into sheet
     Init Sheets Client   service_account.json
     ${timestamp}         Get Time  UTC
     @{values}            Create List    ${timestamp}   added this text as an example
     Insert Values        ${SHEET_ID}  ${SHEET_RANGE}  @{values}

Usage example (changes needed for above example) when service account file is stored in the Robocloud Vault

*** Settings ***
Library  RPA.Cloud.Google  robocloud_vault_name=google
...                        robocloud_vault_secret_key=service_account

*** Tasks ***
Inserting values into sheet
     Init Sheets Client   use_robocloud_vault=True

Google Sheets keywords:

  • Init Sheets Client
  • Create Sheet
  • Insert Values
  • Get Values
  • Clear Values
3 Likes

Now you can also find detailed instructions to set this up on our docs: https://robocorp.com/docs/development-howtos/google-sheets/interacting-with-google-sheets

3 Likes