Professional Documents
Culture Documents
Bot Overview
This metabot accomplishes the following:
• Performs multiple functions in Google Drive using the Google Drive REST API v3; see complete list of logics below.
• Performs multiple functions in Google Sheets using the Google Sheets REST API v4; see complete list of logics below.
Pre-Requisites
• Automation Anywhere Enterprise v11.x.
• A new or existing Google email account for use with GDrive.
• A Google API & Services Console Setup with:
o Google Drive API
o Google Sheets API
o Compute Engine API (already installed)
o Apps Activity API (already installed)
o Cloud OS Login API (already installed)
o Cloud Source Repositories API (already installed)
• OAuth 2.0 client IDs Downloaded from the Google API & Services Console (used to authenticate services)
• Ensure that scopes are set to in the OAuth Consent Screen for your application as below:
o https://www.googleapis.com/auth/drive
o https://www.googleapis.com/auth/spreadsheets
o This is done through your application control panel here:
o https://console.developers.google.com/apis/credentials/consent?project=<your project id>
• Refer to for Google's Quick Start instructions for how to enable the Drive API (Step 1 only):
• https://developers.google.com/drive/api/v3/quickstart/dotnet
Installation
1. Download the bot from Bot Store.
2. Unzip the zip archive.
3. For first time users, create “Bot Store” folder under <AA Directory>/My Tasks (on your local disk).
4. Copy folder “GDriver” to above created Bot Store folder inside <AA Directory>/My Tasks in Automation Anywhere folder on your local disk.
5. Move the “GDriver.mbot” file from (unzipped) GDriver/My Metabots to <AA Directory>/My Metabots folder in Automation Anywhere
directory on your local disk.
Create the following folder structure of the content in the AA Dir:
- <AA Directory>
o My Tasks
▪ Bot Store
• GDriver (Folder)
o My Tasks
▪ Test Mbot Logic - *.atmx (test files, each file allows for testing of each function)
o Error Folder
▪ Logs (Folder)
• Error Logs Month-Day-Year.txt
▪ Snapshots (Folder)
• Error Snap Month-Day-Year.png
o My Metabots
▪ GDriver.mbot
Common Concepts
Many of the functions below use the same variables from either the GDrive API or the Sheets API. Please refer to the description of these variables wherever
necessary.
GDrive File Id
Every file on GDrive has a unique id or identifier as follows:
string vGDriveFileId – the id of the file on GDrive upon which you want to take the specified action (Ex:
https://docs.google.com/spreadsheets/d/13bZs0aj7aRhLS1enfLxYV5D8BLP5jLQotFLIT7gTzWE/edit#gid=0; the bold red portion of the
document URL above is a GDrive file id).
Note: that the Sheets API refers to the GDrive File Id as the Spreadsheet Id. For the purposes of Metabot functions dealing with the Google Sheet
API, the term GDrive File Id and the variable above is used to refer to the Spreadsheet Id for internal consistency.
Note: GDrive file names are non-unique. In other words, you can have two files with the same name. The file id is what distinguishes them from
one another.
Output
string vOutput = "Success" or "Google API says: " followed by and API-specific API error message.
Most of the functions produce an output string against which decisions in code can be made. In short, when an API call succeeds the API returns "Success."
When the API call does not succeed due to an error, the API will report the API error instead. These errors are generally out-of-scope for the Metabot itself and
fall into the realm of Google's API documentation (see above). In most cases, such errors are generally caused by providing unexpected inputs. For example, not
providing a cell range reference where a cell range reference is expected. Please see Google's API documentation for understanding how such issues may occur
and how to best resolve them.
GDrive Functions
Logic Inputs Outputs Comments
string vLocalTargetFile – a full-path Gets information about the user, the user's
filename that indicates where you drive, and system capabilities
want to save or log the About • string vOutput
About information (Ex: • A .txt or .json file Please refer to Google's API documentation
$AAApplicationPath$\Automation • See comments for more detailed specifics about the
Anywhere\My Docs\GDriveAbout.txt); format of the output: About.
may also be saved as a .json file.
Authenticate user using the json file from
the GDrive API.
The 1st part of the pipe-delimited Also see Google's API documentation on
Cells Change Border Style
string indicates where to draw a string vOutput Cell Styles.
border as follows:
• "L" = Left edge of a cell Also see Google's API documentation on
Colors.
• "R" = Right edge of a cell
• "T" = Top edge of a cell
Also see Hex to RGBA Converter Online
• "B" = Bottom edge of a cell
Tool for formulating colors from Hex codes.
The second pipe-delimited string is
the style of the border as follows:
• "Dotted" = The border is dotted.
• "Dashed" = The border is dashed.
• "Solid" = The border is a thin solid
line.
• "Solid Medium" = The border is a
medium solid line.
• "Solid Thick" = The border is a
thick solid line.
Google Sheets Functions
Logic Inputs Outputs Comments
• "None" = No border. Used only
when updating a border in order
to erase it.
• "Double" = The border is two solid
lines.
Date-based rules:
• "Date is in the past week"
• "Date is in the past month"
• "Date is in the past year"
Error Handling
- Each Bot folder contains the below hierarchy.
o Error Folder
▪ Logs
• Error Logs Month-Day-Year.txt: In case of any error, this file logs error message along with time stamp
▪ Snapshots
• Error Snap Month-Day-Year.png: In case of any error, this file captures screenshot of error.
- Task Status of bot is set to failed in case of error.