RPA.Cloud.Google

Arguments

ArgumentTypeDefault value
mimeMessagenull
attachmentnull
iv>

Keyword for sharing drive file or folder.

Arguments

ArgumentTypeDefault value
file_idstr, NoneNone
file_dictdict, NoneNone
querystr, NoneNone
sourcestr, NoneNone
emailstr, NoneNone
domainstr, NoneNone
roleDriveRoleREADER
share_typeDriveTypeUSER
notificationboolFalse
notification_messagestr, NoneNone

Parameters file_id, file_dict, query and source can be used to select files to which sharing is added to.

If share is added to a folder, all files within that folder get same sharing permissions.

param file_id:drive file id
param file_dict:file dictionary returned by Search Drive Files
param query:drive query string to find target file, needs to match 1 file
param source:name of the folder to search files in, is by default drive's root folder
param email:user or group email address if share type is DriveType.USER or DriveType.GROUP
param domain:domain name if share type is DriveType.DOMAIN
param role:see DriveRole enum for possible values, defaults to DriveRole.READER
param share_type:see DriveType enum for possible values, defaults to DriveType.USER
param notification:whether to send notificatin email, defaults to False
param notification_message:optional message to include with the notification
return:share response dictionary containing 'file_id' and 'permission_id'

Usage

# Add file share for a email address with email notification Add Drive Share ... query=name = 'okta.png' ... email=robocorp.tester@gmail.com ... notification=True ... notification_message=Hello. I have shared 'okta.png' with you for review. # Add file share for a domain Add Drive Share ... query=name = 'okta.png' ... domain=robocorp.com # Add folder share for a email address ${folder}= Create Drive Directory attachments-for-the-task ${share}= Add Drive Share ... file_id=${folder}[id] ... email=robocorp.tester@gmail.com ... role=writer Log To Console Share details: ${share}[file_id], ${share}[permission_id]

Analyze sentiment in a text file

Arguments

ArgumentTypeDefault value
textstr, NoneNone
text_filestr, NoneNone
file_typeTextTypeTEXT
json_filestr, NoneNone
langstr, NoneNone
param text:source text
param text_file:source text file
param file_type:type of text, PLAIN_TEXT (default) or HTML
param json_file:json target to save result, defaults to None
param lang:language code of the source, defaults to None
return:analysis response

For list of supported languages: https://cloud.google.com/natural-language/docs/languages

Examples

Robot Framework

${result}= Analyze Sentiment ${text} ${result}= Analyze Sentiment text_file=${CURDIR}${/}test.txt

Annotate image

Arguments

ArgumentTypeDefault value
image_filestrnull
image_uristrnull
json_filestr, NoneNone
param image_file:source image file path
param image_uri:Google Cloud Storage URI
param json_file:json target to save result
return:detection response

Examples

Robot Framework

${result}= Annotate Image image_file=${CURDIR}${/}test.png ... json_file=${CURDIR}${/}result.json

Annotate video

Arguments

ArgumentTypeDefault value
video_filestr, NoneNone
video_uristr, NoneNone
featuresstr, NoneNone
output_uristr, NoneNone
json_filestr, NoneNone
timeoutint300

Possible values for features:

  • FEATURE_UNSPECIFIED, Unspecified.
  • LABEL_DETECTION, Label detection. Detect objects, such as dog or flower.
  • SHOT_CHANGE_DETECTION, Shot change detection.
  • EXPLICIT_CONTENT_DETECTION, Explicit content detection.
  • SPEECH_TRANSCRIPTION, Speech transcription.
  • TEXT_DETECTION, OCR text detection and tracking.
  • OBJECT_TRACKING, Object detection and tracking.
  • LOGO_RECOGNITION, Logo detection, tracking, and recognition.

If video_uri is given then that is used even if video_file is given.

param video_file:local file path to input video
param video_uri:Google Cloud Storage URI to input video
param features:list of annotation features to detect, defaults to LABEL_DETECTION,SHOT_CHANGE_DETECTION
param output_uri:Google Cloud Storage URI to store response json
param json_file:json target to save result
param timeout:timeout for operation in seconds
return:annotate result

Examples

Robot Framework

${result}= Annotate Video video_uri=gs://videointelligence/movie.mp4 ... features=TEXT_DETECTION,LABEL_DETECTION ... output_uri=gs://videointelligence/movie_annotations.json ... json_file=${CURDIR}${/}videoannotations.json

Classify text

Arguments

ArgumentTypeDefault value
textstr, NoneNone
text_filestr, NoneNone
file_typeTextTypeTEXT
json_filestr, NoneNone
langstr, NoneNone
param text:source text
param text_file:source text file
param file_type:type of text, PLAIN_TEXT (default) or HTML
param json_file:json target to save result, defaults to None
param lang:language code of the source, defaults to None
return:classify response

For list of supported languages: https://cloud.google.com/natural-language/docs/languages

Examples

Robot Framework

${result}= Classify Text ${text} ${result}= Classify Text text_file=${CURDIR}${/}test.txt

Clear cell values for range of cells within a spreadsheet

Arguments

ArgumentTypeDefault value
spreadsheet_idstrnull
sheet_rangestrnull
param spreadsheet_id:target spreadsheet
param sheet_range:target sheet range
return:operation result

Examples

Python

result = GOOGLE.clear_sheet_values(spreadsheet_id, "A1:C1")

Robot Framework

${result}= Clear Sheet Values ${SPREADSHEET_ID} A1:C1

Copy sheet into the spreadsheet as new sheet

Arguments

ArgumentTypeDefault value
spreadsheet_idstrnull
source_sheet_namestrnull
new_sheet_namestrnull
insertSheetIndexint, NoneNone
param spreadsheet_id:id of the spreadsheet
param source_sheet_name:name of the source sheet
param new_sheet_name:name for the new sheet
param insertSheetIndex:zero based index where the new sheet should be inserted, defaults to None
return:operation result as an dictionary

Examples

Python

result = GOOGLE.copy_sheet( spreadsheet_id, "Existing sheet", "Copy of existing sheet" )

Robot Framework

${result}= Copy Sheet ... ${SPREADSHEET_ID} ... Existing sheet ... Copy of existing sheet

Copy spreadsheet to target spreadsheet

Arguments

ArgumentTypeDefault value
spreadsheet_idstrnull
target_spreadsheet_idstrnull

NOTE: service account user must have access also to target spreadsheet

param spreadsheet_id:ID of the spreadsheet to copy
param target_spreadsheet_id:ID of the target spreadsheet
return:operation result

Examples

Python

result = GOOGLE.copy_spreadsheet( spreadsheet_id, source_spreadsheet_id, target_spreadsheet_id)

Robot Framework

${result}= Copy Spreadsheet ${SPREADSHEET_ID} ${ANOTHER_SPREADSHEET_ID}

Create new directory to Google Drive

Arguments

ArgumentTypeDefault value
folderstr, NoneNone
parent_folderstr, NoneNone
param folder:name for the new directory
param parent_folder:top level directory for new directory
return:dictionary containing folder ID and folder URL

Usage

${folder}= Create Drive Directory example-folder Log To Console Google Drive folder ID: ${folder}[id] Log To Console Google Drive folder URL: ${folder}[url]

Create a message for an email.

Arguments

ArgumentTypeDefault value
tostrnull
subjectstrnull
message_textstrnull
attachmentslist, NoneNone
htmlboolFalse
param to:message recipient
param subject:message subject
param message_text:message body text
param attachment:list of files to add as message attachments
param html:set to True if message body is HTML (default False, plain text)
return:An object containing a base64url encoded email object

Create sheet into the spreadsheet

Arguments

ArgumentTypeDefault value
spreadsheet_idstrnull
sheet_namestrnull
param spreadsheet_id:id of the spreadsheet
param sheet_name:name for the new sheet
return:operation result as an dictionary

Examples

Python

result = GOOGLE.create_sheet(spreadsheet_id, "New sheet")

Robot Framework

${result}= Create Sheet ${SPREADSHEET_ID} New sheet

Create empty sheet with a title

Arguments

ArgumentTypeDefault value
titlestrnull
param title:name as string
return:created spreadsheet_id

Examples

Python

result = GOOGLE.create_spreadsheet("name of the spreadsheet")

Robot Framework

${result}= Create Sheet Example Sheet

Create Google Cloud Storage bucket

Arguments

ArgumentTypeDefault value
bucket_namestrnull
param bucket_name:name as string
return:bucket

Examples

Robot Framework

${result}= Create Storage Bucket visionfolder

Delete file specified by id, file dictionary or query string

Arguments

ArgumentTypeDefault value
file_idstr, NoneNone
file_dictdict, NoneNone
querystr, NoneNone
multiple_okboolFalse
suppress_errorsboolFalse

Note. Be extra careful when calling this keyword!

param file_id:drive file id
param file_dict:file dictionary returned by Search Drive Files
param query:drive query string to find target file, needs to match 1 file unless parameter multiple_ok is set to True
param multiple_ok:set to True if it is ok to perform delete on more than 1 file
param suppress_errors:on True will log warning message instead of raising an exception, defaults to False
return:how many files where deleted

Usage

${folder_id}= Get Drive Folder Id datafolder ${deleted}= Delete Drive File query=name contains '.json' and '${folder_id}' in parents ... multiple_ok=True

Delete a sheet from the spreadsheet.

Arguments

ArgumentTypeDefault value
spreadsheet_idstrnull
sheet_namestrnull
param spreadsheet_id:id of the spreadsheet
param sheet_name:name of the sheet to delete
return:operation result as an dictionary

Examples

Python

result = GOOGLE.delete_sheet(spreadsheet_id, "Sheet1")

Robot Framework

${result}= Delete Sheet ${SPREADSHEET_ID} Sheet1

Delete Google Cloud Storage bucket

Arguments

ArgumentTypeDefault value
bucket_namestrnull

Bucket needs to be empty before it can be deleted.

param bucket_name:name as string

Examples

Robot Framework

${result}= Delete Storage Bucket visionfolder

Delete files in the bucket

Arguments

ArgumentTypeDefault value
bucket_namestrnull
filesAnynull

Files need to be object name in the bucket.

param bucket_name:

name as string

param files:

single file, list of files or comma separated list of files

return:

list of files which could not be deleted

Examples

Robot Framework

${result}= Delete Storage Files ${BUCKET_NAME} file1,file2

Detect document

Arguments

ArgumentTypeDefault value
image_filestr, NoneNone
image_uristr, NoneNone
json_filestr, NoneNone
param image_file:source image file path
param image_uri:Google Cloud Storage URI
param json_file:json target to save result
return:detection response

Examples

Robot Framework

${result}= Detect Document image_file=${CURDIR}${/}test.png ... json_file=${CURDIR}${/}result.json

Detect labels in the image

Arguments

ArgumentTypeDefault value
image_filestr, NoneNone
image_uristr, NoneNone
json_filestr, NoneNone
param image_file:source image file path
param image_uri:source image uri
param json_file:json target to save result
return:detection response

Examples

Robot Framework

${result}= Detect Labels image_file=${CURDIR}${/}test.png ... json_file=${CURDIR}${/}result.json

Detect tables in the sheet.

Arguments

ArgumentTypeDefault value
spreadsheet_idstrnull
sheet_namestr, NoneNone
param spreadsheet_id:id of the spreadsheet
param sheet_name:name of the sheet, or leave None for all sheets
return:tables arranged by sheets

Detect text in the image

Arguments

ArgumentTypeDefault value
image_filestr, NoneNone
image_uristr, NoneNone
json_filestr, NoneNone
param image_file:source image file path
param image_uri:Google Cloud Storage URI
param json_file:json target to save result
return:detection response

Examples

Robot Framework

${result}= Detect Text image_file=${CURDIR}${/}test.png ... json_file=${CURDIR}${/}result.json

Download files specified by file dictionary or query string

Arguments

ArgumentTypeDefault value
file_dictdict, NoneNone
querystr, NoneNone
sourcestr, NoneNone
limitint, NoneNone
timeoutfloat, NoneNone

Parameters start, limit and timeout are used only when downloading files defined by query parameter.

param file_dict:file dictionary returned by Search Drive Files
param query:drive query string to find target files, defaults to None
param source:source directory where query is executed
param limit:maximum amount of files that are downloaded, defaults to None
param timeout:maximum allowed time in seconds for download process
return:list of downloaded files

Usage

${files}= Search Drive Files query=name contains '.json' FOR ${f} IN @{files} IF ${f}[size] < 2000 Download Drive Files file_dict=${f} END END ${folder_id}= Get Drive Folder Id datafolder Download Drive Files query=name contains '.json' and '${folder_id}' in parents

Download files from a bucket

Arguments

ArgumentTypeDefault value
bucket_namestrnull
filesAnynull

Example files: files = {"mytestimg": "image1.png", "mydoc": "google.pdf"}

param bucket_name:name as string
param files:list of object names or dictionary of object names and target files
return:list of files which could not be downloaded

Examples

Robot Framework

${result}= Download Storage Files ${BUCKET_NAME} test1.txt,test2.txt

Export Google Drive file using Drive export links

Arguments

ArgumentTypeDefault value
file_idstr, NoneNone
file_dictdict, NoneNone
target_filestr, NoneNone
mimetypestrapplication/pdf
param file_id:drive file id
param file_dict:file dictionary returned by Search Drive Files
param target_file:name for the exported file
param mimetype:export mimetype, defaults to "application/pdf"
return:file path to the exported file

Usage

${files}= Drive Search Files query=name contains 'my example worksheet' Export Drive File file_dict=${files}[0]

Detect faces

Arguments

ArgumentTypeDefault value
image_filestr, NoneNone
image_uristr, NoneNone
json_filestr, NoneNone
param image_file:source image file path
param image_uri:Google Cloud Storage URI
param json_file:json target to save result
return:detection response

Examples

Robot Framework

${result}= Face Detection image_uri=gs://vision/faces.png ... json_file=${CURDIR}${/}result.json

This keyword allows to do generic batch update to the spreadsheet.

Arguments

ArgumentTypeDefault value
spreadsheet_idstrnull
bodyDictnull

For more information on the batch update: https://googleapis.github.io/google-api-python-client/docs/dyn/sheets_v4.spreadsheets.html#create

List of possible requests actions (body can contain multiple at the same time):

  • addBanding
  • addChart
  • addConditionalFormatRule
  • addDataSource
  • addDimensionGroup
  • addFilterView
  • addNamedRange
  • addProtectedRange
  • addSheet (keyword Create sheet)
  • addSlicer
  • appendCells
  • appendDimension
  • autoFill
  • autoResizeDimensions
  • clearBasicFilter
  • copyPaste
  • createDeveloperMetadata
  • cutPaste
  • deleteBanding
  • deleteConditionalFormatRule
  • deleteDataSource
  • deleteDeveloperMetadata
  • deleteDimension
  • deleteDimensionGroup
  • deleteDuplicates
  • deleteEmbeddedObject
  • deleteFilterView
  • deleteNamedRange
  • deleteProtectedRange
  • deleteRange
  • deleteSheet (keyword Delete sheet)
  • duplicateFilterView
  • duplicateSheet (keyword Copy sheet)
  • findReplace
  • insertDimension
  • insertRange
  • mergeCells
  • moveDimension
  • pasteData
  • randomizeRange
  • refreshDataSource
  • repeatCell
  • setBasicFilter
  • setDataValidation
  • sortRange
  • textToColumns
  • trimWhitespace
  • unmergeCells
  • updateBanding
  • updateBorders
  • updateCells
  • updateChartSpec
  • updateConditionalFormatRule
  • updateDataSource
  • updateDeveloperMetadata
  • updateDimensionGroup
  • updateDimensionProperties
  • updateEmbeddedObjectBorder
  • updateEmbeddedObjectPosition
  • updateFilterView
  • updateNamedRange
  • updateProtectedRange
  • updateSheetProperties (keyword Rename sheet)
  • updateSlicerSpec
  • updateSpreadsheetProperties
param spreadsheet_id:id of the spreadsheet
param body:body of the batch update request
return:operation result as an dictionary

Examples

Python

body = {"requests": {"deleteSheet": {"sheetId": "333555666"}}} result = GOOGLE.generic_spreadsheet_batch_update(spreadsheet_id, body)

Robot Framework

${body}= Evaluate {"requests": {"deleteSheet": {"sheetId": "333555666"}}} ${result}= Generic Spreadsheet Batch Update ${SPREADSHEET_ID} ${body}

Get values from the range in the spreadsheet

Arguments

ArgumentTypeDefault value
spreadsheet_idstrnull
sheet_namestr, NoneNone
value_render_optionstrUNFORMATTED_VALUE
datetime_render_optionstrFORMATTED_STRING
param spreadsheet_id:target spreadsheet
param sheet_name:target sheet (default first sheet)
param value_render_option:how values should be represented in the output defaults to "UNFORMATTED_VALUE"
param datetime_render_option:how dates, times, and durations should be represented in the output, defaults to "FORMATTED_STRING"
return:operation result

Examples

Python

result = GOOGLE.get_all_sheet_values(spreadsheet_id)

Robot Framework

${values}= Get All Sheet Values ${SHEET_ID} sheet1

Helper keyword for getting document entities from a Process Document response object.

Arguments

ArgumentTypeDefault value
documentDocumentnull

For examples. see Process Document keyword

param document:the document response object
return:detected entities in the document response as a list

Helper keyword for getting detected languages from a Process Document response object.

Arguments

ArgumentTypeDefault value
documentDocumentnull

For examples. see Process Document keyword

param document:the document response object
return:detected languages in the document response as a list

Get file dictionary by its file id.

Arguments

ArgumentTypeDefault value
file_idstrnull
suppress_errorsboolFalse
param file_id:id of the file in the Google Drive
param suppress_errors:on True will log warning message instead of raising an exception, defaults to False (exception is raised)
return:dictionary containing file information

Usage

${file_dict}= Get Drive File By ID file_id=${FILE_ID}

Get file id for the folder

Arguments

ArgumentTypeDefault value
folderstr, NoneNone
parent_folderstr, NoneNone
detailsboolFalse
param folder:name of the folder to identify, by default returns drive's root folder id
param parent_folder:can be used to narrow search by giving parent folder name
param details:on True will return folder dictionary, on False (default) folder id is returned
return:file id of the folder or file dictionary when details = True

Usage

${root_id}= Get Drive Folder Id # returns Drive root folder id ${folder_id}= Get Drive Folder Id subdir

Arguments

ArgumentTypeDefault value
spreadsheet_idstrnull
sheet_namestrnull
iv>

Get formulas from the sheet.

Arguments

ArgumentTypeDefault value
spreadsheet_idstrnull
sheet_namestrnull
param spreadsheet_id:id of the spreadsheet
param sheet_name:name of the sheet
return:_description_

Get values from the range in the spreadhsheet

Arguments

ArgumentTypeDefault value
spreadsheet_idstrnull
sheet_rangestr, NoneNone
value_render_optionstrUNFORMATTED_VALUE
datetime_render_optionstrFORMATTED_STRING
param spreadsheet_id:target spreadsheet
param sheet_range:target sheet range
param value_render_option:how values should be represented in the output defaults to "UNFORMATTED_VALUE"
param datetime_render_option:how dates, times, and durations should be represented in the output, defaults to "FORMATTED_STRING"
return:operation result

Examples

Python

result = GOOGLE.get_sheet_values(spreadsheet_id, "A1:C1")

Robot Framework

${values}= Get Sheet Values ${SPREADSHEET_ID} A1:C1

Get title, id, url and sheets information from the spreadsheet.

Arguments

ArgumentTypeDefault value
spreadsheet_idstrnull
param spreadsheet_id:ID of the spreadsheet
return:operation result as an dictionary

Returns spreadsheet information as a dictionary.

Arguments

ArgumentTypeDefault value
spreadsheet_idstrnull
param spreadsheet_id:ID of the spreadsheet
return:operation result as an dictionary

Get Google Cloud Storage bucket

Arguments

ArgumentTypeDefault value
bucket_namestrnull
param bucket_name:name as string
return:bucket

Examples

Robot Framework

${result}= Get Bucket visionfolder

Arguments

ArgumentTypeDefault value
parsed_partsnull
partnull
msgnull
folder_namenull
iv>

Initialize Google Apps Script client

Arguments

ArgumentTypeDefault value
service_accountstr, NoneNone
credentialsstr, NoneNone
use_robocorp_vaultbool, NoneNone
scopeslist, NoneNone
token_filestr, NoneNone
param service_account:file path to service account file
param credentials:file path to credentials file
param use_robocorp_vault:use credentials in Robocorp Vault
param scopes:list of extra authentication scopes
param token_file:file path to token file

Initialize Google Cloud Document AI client

Arguments

ArgumentTypeDefault value
service_accountstr, NoneNone
regionstr, Noneus
use_robocorp_vaultbool, NoneNone
token_filestr, NoneNone
param service_account:file path to service account file
param region:region of the service
param use_robocorp_vault:use credentials in Robocorp Vault
param token_file:file path to token file

Robot Framework example:

# Init using Service Account from a file Init Document AI ${CURDIR}${/}service_account.json region=eu # Init using OAuth token from a file and default "us" region Init Document AI ${CURDIR}${/}token.json # Init using service account file from the Robocorp Vault Set Robocorp Vault ... vault_name=DocumentAI ... vault_secret_key=google-sa Init Document AI region=eu use_robocorp_vault=True

Python example:

GOOGLE = Google() GOOGLE.set_robocorp_vault("DocumentAI", "google-sa") GOOGLE.init_document_ai(region="eu", use_robocorp_vault=True)

Initialize Google Drive client

Arguments

ArgumentTypeDefault value
service_accountstr, NoneNone
credentialsstr, NoneNone
use_robocorp_vaultbool, NoneNone
scopeslist, NoneNone
token_filestr, NoneNone
param service_account:file path to service account file
param credentials:file path to credentials file
param use_robocorp_vault:use credentials in Robocorp Vault
param scopes:list of extra authentication scopes
param token_file:file path to token file

Initialize Google Gmail client

Arguments

ArgumentTypeDefault value
service_accountstr, NoneNone
credentialsstr, NoneNone
use_robocorp_vaultbool, NoneNone
scopeslist, NoneNone
token_filestr, NoneNone
param service_account:file path to service account file
param credentials:file path to credentials file
param use_robocorp_vault:use credentials in Robocorp Vault
param scopes:list of extra authentication scopes
param token_file:file path to token file

Initialize Google Cloud Natural Language client

Arguments

ArgumentTypeDefault value
service_accountstr, NoneNone
use_robocorp_vaultbool, NoneNone
token_filestr, NoneNone
param service_account:file path to service account file
param use_robocorp_vault:use credentials in Robocorp Vault
param token_file:file path to token file

Initialize Google Sheets client

Arguments

ArgumentTypeDefault value
service_accountstr, NoneNone
credentialsstr, NoneNone
use_robocorp_vaultbool, NoneNone
scopeslist, NoneNone
token_filestr, NoneNone
param service_account:file path to service account file
param credentials:file path to credentials file
param use_robocorp_vault:use credentials in Robocorp Vault
param scopes:list of extra authentication scopes
param token_file:file path to token file

Initialize Google Cloud Speech to Text client

Arguments

ArgumentTypeDefault value
service_accountstr, NoneNone
use_robocorp_vaultbool, NoneNone
token_filestr, NoneNone
param service_account:file path to service account file
param use_robocorp_vault:use credentials in Robocorp Vault
param token_file:file path to token file

Initialize Google Cloud Storage client

Arguments

ArgumentTypeDefault value
service_accountstr, NoneNone
use_robocorp_vaultbool, NoneNone
token_filestr, NoneNone
param service_account:file path to service account file
param use_robocorp_vault:use credentials in Robocorp Vault
param token_file:file path to token file

Initialize Google Cloud Text to Speech client

Arguments

ArgumentTypeDefault value
service_accountstr, NoneNone
use_robocorp_vaultbool, NoneNone
token_filestr, NoneNone
param service_account:file path to service account file
param use_robocorp_vault:use credentials in Robocorp Vault
param token_file:file path to token file

Initialize Google Cloud Translation client

Arguments

ArgumentTypeDefault value
project_identifierstrnull
service_accountstr, NoneNone
use_robocorp_vaultbool, NoneNone
token_filestr, NoneNone
param project_identifier:identifier for Translation project
param service_account:file path to service account file
param use_robocorp_vault:use credentials in Robocorp Vault
param token_file:file path to token file

Initialize Google Cloud Video Intelligence client

Arguments

ArgumentTypeDefault value
service_accountstr, NoneNone
use_robocorp_vaultbool, NoneNone
token_filestr, NoneNone
param service_account:file path to service account file
param use_robocorp_vault:use credentials in Robocorp Vault
param token_file:file path to token file

Initialize Google Cloud Vision client

Arguments

ArgumentTypeDefault value
service_accountstr, NoneNone
use_robocorp_vaultbool, NoneNone
token_filestr, NoneNone
param service_account:file path to service account file
param use_robocorp_vault:use credentials in Robocorp Vault
param token_file:file path to token file

Insert values into sheet cells

Arguments

ArgumentTypeDefault value
spreadsheet_idstrnull
sheet_rangestrnull
valueslistnull
major_dimensionstrCOLUMNS
value_input_optionstrUSER_ENTERED
param spreadsheet_id:target spreadsheet
param sheet_range:target sheet range
param values:list of values to insert into sheet
param major_dimension:major dimension of the values, default COLUMNS
param value_input_option:controls whether input strings are parsed or not, default USER_ENTERED
return:operation result

Examples

Python

values = [[11, 12, 13], ['aa', 'bb', 'cc']] result = GOOGLE.insert_sheet_values(spreadsheet_id, "A:C", values)

Robot Framework

${values} Evaluate [[11, 12, 13], ['aa', 'bb', 'cc']] ${result}= Insert Sheet Values ${SPREADSHEET_ID} A:B ${values} ${result}= Insert Sheet Values ${SPREADSHEET_ID} A:B ${values} ROWS

List messages

Arguments

ArgumentTypeDefault value
user_idstrnull
querystrnull
folder_namestr, NoneNone
label_idslist, NoneNone
max_resultsint, NoneNone
include_jsonboolFalse
include_spamboolFalse
param user_id:user's email address. The special value me can be used to indicate the authenticated user.
param query:message query
param folder_name:path where attachments are saved, default current directory
param label_ids:message label ids
param max_results:maximum number of message to return
param include_json:include original response json
param include_spam:include messages from SPAM and TRASH
return:messages

Usage

${messages}= List Messages me ... from:mika@robocorp.com ... folder_name=${CURDIR}${/}target ... include_json=True FOR ${msg} IN @{messages} Log Many ${msg} END

List existing document AI processors from given project and region.

Arguments

ArgumentTypeDefault value
project_idstrnull
regionstrnull

Requires documentai.processors.list permission.

param project_id:Google Cloud project ID
param region:Google Cloud region of the processor
return:list of available processors as a list

Robot Framework example:

@{processors}= List Processors ${PROJECT_ID} eu FOR ${p} IN @{processors} # name: projects/PROJECT_ID/locations/REGION/processors/PROCESSOR_ID Log To Console Processor name: ${p.name} Log To Console Processor type: ${p.type_} Log To Console Processor display name: ${p.display_name} END

Python example:

processors = GOOGLE.list_processors(PROJECT_ID, "eu") for p in processors: print(f"Processor name: {p.name}") print(f"Processor type: {p.type_}") print(f"Processor name: {p.display_name}")

Keyword for listing shared files in the source folder.

Arguments

ArgumentTypeDefault value
querystr, NoneNone
sourcestr, NoneNone

Alias keyword for Search Drive Files which can be used to list only files which have been shared.

param query:drive query string to find target files
param source:source directory where query is executed
return:list of shared files

Usage

${shared}= List Shared Drive Files source=subfolder FOR ${file} IN @{shared} Log To Console ${file} END

List Google Cloud Storage buckets

return:list of buckets

Examples

Robot Framework

${buckets}= List Storage Buckets FOR ${bucket} IN @{buckets} Log ${bucket} END

List files in the bucket

Arguments

ArgumentTypeDefault value
bucket_namestrnull
param bucket_name:name as string
return:list of object names in the bucket

Examples

Robot Framework

${files}= List Storage Files ${BUCKET_NAME} FOR ${bucket} IN @{files} Log ${file} END

List supported voices for the speech

Arguments

ArgumentTypeDefault value
language_codestr, NoneNone
param language_code:voice languages to list, defaults to None (all)
return:list of supported voices

Examples

Robot Framework

${result}= List Supported Voices en-US

Loads the binary object saved by Save Document Response into documentai.Document format which is accessible by helper keywords.

Arguments

ArgumentTypeDefault value
filepathstrnull
param filepath:source file to read binary document object from
return:processed document response object

Robot Framework example:

# load previously saved response ${document}= Load Document Response ${CURDIR}${/}google_processed.response ${entities}= Get Document Entities ${document}

Python example:

document = GOOGLE.load_document_response("google_doc.response") entities = GOOGLE.get_document_entities(document) for ent in entities: print(ent)

Move file specified by id, file dictionary or query string into target folder

Arguments

ArgumentTypeDefault value
file_idstr, NoneNone
file_dictdict, NoneNone
querystr, NoneNone
sourcestr, NoneNone
targetstr, NoneNone
multiple_okboolFalse
param file_id:drive file id
param file_dict:file dictionary returned by Search Drive Files
param query:drive query string to find target file, needs to match 1 file
param source:name of the folder to move file from, is by default drive's root folder id
param target:name of the folder to move file into, is by default drive's root folder id
param multiple_ok:if True then moving more than 1 file
return:list of file ids

Usage

${source_id}= Get Drive Folder Id sourcefolder ${query}= Set Variable name contains '.json' and '${sourceid}' in parents ${files}= Move Drive File query=${query} folder=target_folder multiple_ok=True

Utility function that parses the content of an email partition

Arguments

ArgumentTypeDefault value
msg_idnull
msgnull
partsnull
folder_namenull

Process document in the Google Cloud platform using given document processor ID within given project and region.

Arguments

ArgumentTypeDefault value
project_idstrnull
regionstrnull
processor_idstrnull
file_pathstrnull
mime_typestr, NoneNone

For a full list of Document response object attributes, please reference this page.

param project_id:Google Cloud project ID
param region:Google Cloud region of the processor
param processor_id:ID of the document processor
param file_path:filepath of the document to process
param mime_type:given mime type of document (optional), if not given it is auto detected
return:processed document response object

Robot Framework example:

${document}= Process Document ... project_id=${GOOGLE_PROJECT_ID} ... region=eu ... processor_id=${RECEIPT_PROCESSOR_ID} ... file_path=${CURDIR}${/}mydocument.pdf ${entities}= Get Document Entities ${document} FOR ${ent} IN @{entities} Log To Console Entity: ${ent} END ${languages}= Get Document Languages ${document} Log To Console Languages: ${languages}

Python example:

document = GOOGLE.process_document( project_id=PROJECT_ID, region="eu", processor_id=PROCESSOR_ID, file_path="./files/mydocument.pdf", ) entities = GOOGLE.get_document_entities(document) for ent in entities: print(ent) languages = GOOGLE.get_document_languages(document) for lang in languages: print(lang)

Recognize text in the audio file

Arguments

ArgumentTypeDefault value
audio_filestr, NoneNone
audio_uristr, NoneNone
encodingstr, NoneNone
language_codestren_US
audio_channel_countint2
sample_rateint, NoneNone
param audio_file:local audio file path
param audio_uri:Google Cloud Storage URI
param encoding:audio file encoding
param language_code:language in the audio
param audio_channel_count:number of audio channel
param sample_rate:rate in hertz, for example 16000
return:recognized texts

Examples

Robot Framework

${result}= Recognize Text From Audio audio_file=${CURDIR}${/}test.mp3

Keyword for removing all shares from selected files (only owner permission is retained).

Arguments

ArgumentTypeDefault value
file_idstr, NoneNone
file_dictdict, NoneNone
querystr, NoneNone
suppress_errorsboolFalse
param file_id:drive file id
param file_dict:file dictionary returned by Search Drive Files
param query:drive query string to find target files
param suppress_errors:on True will log warning message instead of raising an exception, defaults to False (exception is raised)
return:list of dictionaries containing information of file permissions removed

Usage

${removed}= Remove All Drive Shares file_id=${FOLDER_ID}

Keyword for removing share from file or folder based on criteria.

Arguments

ArgumentTypeDefault value
emailstr, NoneNone
domainstr, NoneNone
permission_idstr, NoneNone
file_idstr, NoneNone
file_dictdict, NoneNone
querystr, NoneNone
sourcestr, NoneNone
suppress_errorsboolFalse

Parameters file_id, file_dict, query and source can be used to select files from which sharing is removed.

Parameters email, domain or permission_id can be used to select which share is removed from selected files.

param email:email address of the permission to remove
param domain:domain name of the permission to remove
param permission_id:id of the permission to remove
param file_id:drive file id
param file_dict:file dictionary returned by Search Drive Files
param query:drive query string to find target files
param source:name of the folder to search files in, is by default drive's root folder
param suppress_errors:on True will log warning message instead of raising an exception, defaults to False (exception is raised)
return:list of dictionaries containing information of file permissions removed

Usage

# Remove domain shares for files in the folder ${FOLDER_NAME} ${removed}= Remove Drive Share By Criteria ... domain=robocorp.com ... source=${FOLDER_NAME} # Remove email share for a file ${removed}= Remove Drive Share By Criteria ... query=name = 'okta.png' ... email=robocorp.tester@gmail.com

Keyword for removing share permission of file or folder permission id.

Arguments

ArgumentTypeDefault value
permission_idstrnull
file_idstr, NoneNone
file_dictdict, NoneNone
querystr, NoneNone
sourcestr, NoneNone
suppress_errorsboolFalse

Parameters file_id, file_dict, query and source can be used to select files from which sharing is removed.

param permission_id:id of the permission to remove
param file_id:drive file id
param file_dict:file dictionary returned by Search Drive Files
param query:drive query string to find target file, needs to match 1 file
param source:name of the folder to search files in, is by default drive's root folder
param suppress_errors:on True will log warning message instead of raising an exception, defaults to False (exception is raised)
return:dictionary of permission response

Usage

${share}= Add Drive Share ... query=name = 'sharable-files' and mimeType = 'application/vnd.google-apps.folder' ... email=robocorp.tester@gmail.com # # Remove Drive Share By Permission Id ${share}[permission_id] ${share}[file_id]

Rename sheet in the spreadsheet

Arguments

ArgumentTypeDefault value
spreadsheet_idstrnull
sheet_namestrnull
new_sheet_namestrnull
param spreadsheet_id:id of the spreadsheet
param sheet_name:existing name of the sheet
param new_sheet_name:name for the new sheet
return:operation result as an dictionary

Examples

Python

result = GOOGLE.rename_sheet(spreadsheet_id, "Sheet1", "New name")

Robot Framework

${result}= Rename Sheet ${SPREADSHEET_ID} Sheet1 New name

Run the Google Apps Script function

Arguments

ArgumentTypeDefault value
script_idstrnull
function_namestrnull
parametersdict, NoneNone
param script_id:Google Script identifier
param function_name:name of the script function
param parameters:script function parameters as a dictionary
raises AssertionError:thrown when Google Script returns errors

Usage

&{params}= Create Dictionary formid=aaad4232 formvalues=1,2,3 ${response}= Run Script abc21397283712da submit_form ${params} Log Many ${response}

Save Process Document response into a binary file.

Arguments

ArgumentTypeDefault value
documentDocumentnull
filepathstrnull
param document:response document object
param filepath:target file to save binary object into

Robot Framework example:

${document}= Process Document ... project_id=101134120147 ... region=eu ... processor_id=${RECEIPT_PROCESSOR} ... file_path=${file_in} # save response for later Save Document Response ${CURDIR}${/}google_processed.response

Python example:

document = GOOGLE.process_document( project_id=PROJECT_ID, region="eu", processor_id=PROCESSOR_ID, file_path="./files/receipt1.jpg", ) GOOGLE.save_document_response(document, "receipt.response")

Search Google Drive for files matching query string

Arguments

ArgumentTypeDefault value
querystr, NoneNone
recurseboolFalse
sourcestr, NoneNone
param query:search string, defaults to None which means that all files and folders are returned
param recurse:set to True if search should recursive
param source:source directory where query is executed
return:list of files

Usage

${files}= Search Drive Files query=name contains 'hello' ${files}= Search Drive Files query=modifiedTime > '2020-06-04T12:00:00' ${files}= Search Drive Files query=mimeType contains 'image/' or mimeType contains 'video/' ${files}= Search Drive Files query=name contains '.yaml' recurse=True ${files}= Search Drive Files query=name contains '.yaml' source=datadirectory

Send an email message.

Arguments

ArgumentTypeDefault value
senderstrnull
tostrnull
subjectstrnull
message_textstrnull
attachmentslist, NoneNone
htmlboolFalse
param sender:message sender
param to:message recipient
param subject:message subject
param message_text:message body text
param attachment:list of files to add as message attachments
param html:set to True if message body is HTML (default False, plain text)
return:sent message

Usage

${attachments}= Create List ... ${CURDIR}${/}random.txt ... ${CURDIR}${/}source.png Send Message me ... mika@robocorp.com ... message subject ... body of the message ... ${attachments}

Arguments

ArgumentTypeDefault value
audio_filenull
audio_urinull
iv>

Arguments

ArgumentTypeDefault value
payloadnull
message_idnull
responsenull
iv>

Arguments

ArgumentTypeDefault value
image_filestr, NoneNone
image_uristr, NoneNone
iv>

Arguments

ArgumentTypeDefault value
user_idnull
querynull
label_idsnull
max_resultsnull
include_spamnull
iv>

Set Robocorp Vault name and secret key name :param vault_name: Robocorp Vault name :param vault_secret_key: Robocorp Vault secret key name :param auth_type: either serviceaccount or token

Arguments

ArgumentTypeDefault value
vault_namestr, NoneNone
vault_secret_keystr, NoneNone
auth_typestrserviceaccount

Synthesize speech synchronously

Arguments

ArgumentTypeDefault value
textstrnull
languagestren-US
namestren-US-Standard-B
genderstrMALE
encodingstrMP3
target_filestrsynthesized.mp3
param text:input text to synthesize
param language:voice language, defaults to "en-US"
param name:voice name, defaults to "en-US-Standard-B"
param gender:voice gender, defaults to "MALE"
param encoding:result encoding type, defaults to "MP3"
param target_file:save synthesized output to file, defaults to "synthesized.mp3"
return:synthesized output in bytes

Examples

Robot Framework

${result}= Synthesize Speech ${text}

Convert a column number and a row number into a cell reference.

Arguments

ArgumentTypeDefault value
column_numberintnull
row_numberintnull
param column_number:column number to convert
param row_number:row number to convert
return:cell reference string

Convert a column number into a column letter(s).

Arguments

ArgumentTypeDefault value
numberintnull
param number:column number to convert
return:column letter(s)

Translate text

Arguments

ArgumentTypeDefault value
textlist, strnull
source_languagestr, NoneNone
target_languagestr, NoneNone
mime_typeTextType, NoneNone
param text:text to translate
param source_language:language code
param target_language:language code
param mime_type:text or html
return:translated text

Examples

Robot Framework

${result}= Translate ${TEXT} target_language=de

Update file specified by id, file dictionary or query string

Arguments

ArgumentTypeDefault value
file_idstr, NoneNone
file_dictdict, NoneNone
querystr, NoneNone
sourcestr, NoneNone
actionUpdateActionstar
multiple_okboolFalse

Possible actions: - star - unstar - trash - untrash

param file_id:drive file id
param file_dict:file dictionary returned by Drive Search Files
param query:drive query string to find target file, needs to match 1 file
param source:source directory where query is executed
param action:update action, default star file
param multiple_ok:set to True if it is ok to perform update on more than 1 file
return:number of updated files

Usage

${folder_id}= Get Drive Folder Id datafolder ${updated}= Update Drive File query=name contains '.json' and '${folder_id}' in parents ... action=star ... multiple_ok=True

Insert values into sheet cells

Arguments

ArgumentTypeDefault value
spreadsheet_idstrnull
sheet_rangestrnull
valueslistnull
major_dimensionstrCOLUMNS
value_input_optionstrUSER_ENTERED
param spreadsheet_id:target spreadsheet
param sheet_range:target sheet range
param values:list of values to insert into sheet
param major_dimension:major dimension of the values, default COLUMNS
param value_input_option:controls whether input strings are parsed or not, default USER_ENTERED
return:operation result

Examples

Python

row_data = [[11, 12, 13], ['aa', 'bb', 'cc']] result = GOOGLE.update_sheet_values( spreadsheet_id, "A1:C1", row_data, "ROWS )

Robot Framework

${row} Evaluate [[22, 33 ,44]] ${result}= Update Sheet Values ... ${SPREADSHEET_ID} ... A6:C6 ... ${row} ... ROWS

Upload files into Drive

Arguments

ArgumentTypeDefault value
filenamestr, NoneNone
folderstr, NoneNone
overwriteboolFalse
make_dirboolFalse
param filename:name of the file to upload
param folder:target folder for upload
param overwrite:set to True if already existing file should be overwritten
param make_dir:set to True if folder should be created if it does not exist
return:uploaded file id

Usage

${file1_id}= Upload Drive File data.json # Upload file to drive root ${file2_id}= Upload Drive File newdata.json new_folder make_dir=True ${file3_id}= Upload Drive File data.json overwrite=True

Upload a file into a bucket

Arguments

ArgumentTypeDefault value
bucket_namestrnull
filenamestrnull
target_namestrnull
param bucket_name:name as string
param filename:filepath to upload file
param target_name:target object name

Examples

Robot Framework

Upload Storage File ${BUCKET_NAME} ... ${CURDIR}${/}test.txt test.txt

Upload files into a bucket

Arguments

ArgumentTypeDefault value
bucket_namestrnull
filesdictnull

Example files: files = {"mytestimg": "image1.png", "mydoc": "google.pdf"}

param bucket_name:name as string
param files:dictionary of object names and filepaths

Examples

Robot Framework

${files}= Create Dictionary ... test1.txt ${CURDIR}${/}test1.txt ... test2.txt ${CURDIR}${/}test2.txt Upload Storage Files ${BUCKET_NAME} ${files}