UiPath Documentation
activities
latest
false

Productivity activities

Last updated May 12, 2026

Google Sheets coded automation APIs

Creates a Google Sheets service.

Namespace: UiPath.Gsuite.Activities.API

Assembly: UiPath.Gsuite.Activities.API (in UiPath.Gsuite.Activities.API.dll)

Constructors

ConstructorDescriptionSyntax
GoogleSheetsServiceInitializes a new instance of the GoogleSheetsService classpublic class GoogleSheetsService : IGoogleSheetsService

Methods

NameDescription
AddSheetAdds a new sheet to the specified spreadsheet.
AddSpreadsheetCreates a new spreadsheet.
AutoFillRangeAutomatically fills a range based on existing data in the given direction.
CopyPasteRangeCopies and pastes data from one range to another.
DeleteColumnDelete a specified column from a sheet or range. The column on the right of the deleted column is then shifted to the left.
DeleteColumn(string, overload)Deletes a column by name, also returning range information.
DeleteColumn(int, overload)Deletes a column by index, also returning range information.
DeleteRangeDeletes a specified range.
DeleteRowsDelete one or several rows from a specified position in a spreadsheet range. When you delete a row, the cells below are shifted up.
DeleteRows(string, overload)Deletes rows by index string (e.g. "0, 2, 5-7"), also returning range information.
DeleteRows(IEnumerable, overload)Deletes rows by index collection, also returning range information.
DeleteSheetDeletes the specified sheet from the specified spreadsheet.
GetNamedRangesGets the list of named ranges within a spreadsheet.
GetRangesGets the list of named ranges and sheets within a spreadsheet.
GetCellColorGets the background color of the first cell in the specified range.
GetSheetsGets the list of sheets within a spreadsheet.
GetSpreadsheetsRetrieves a list of spreadsheets from the specified Google Drive location.
ReadCellReads the contents of the specified cell.
ReadColumnReads the contents of the specified range as a column array.
ReadRangeReads the contents of the specified range.
ReadRange (overload)Reads the contents of the specified range, also returning range information via out parameter.
ReadRowReads the first row from the specified range.
RenameSheetRenames the specified sheet in the specified spreadsheet.
SetRangeColorSets the background color of the specified range.
WriteCellWrites information in the selected spreadsheet cell.
WriteColumnWrite a column in a selected Google Sheets file.
WriteRangeWrites a data table to the indicated range from the selected spreadsheet.
WriteRowWrite a row in a selected file using an Array or Data Row.

Examples

In the following example, you can see how you can use the coded automation APIs to get Google Sheets column values as array.

using GoogleWorkspaceCodedWorkflows.ObjectRepository;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using UiPath.CodedWorkflows;
using UiPath.Core;
using UiPath.Core.Activities.Storage;
using UiPath.Excel;
using UiPath.Excel.Activities;
using UiPath.Excel.Activities.API;
using UiPath.Excel.Activities.API.Models;
using UiPath.GSuite.Activities.Api;
using UiPath.GSuite.Sheets.Enums;
using UiPath.Mail.Activities.Api;
using UiPath.Orchestrator.Client.Models;
using UiPath.Testing;
using UiPath.Testing.Activities.TestData;
using UiPath.Testing.Activities.TestDataQueues.Enums;
using UiPath.Testing.Enums;
using UiPath.UIAutomationNext.API.Contracts;
using UiPath.UIAutomationNext.API.Models;
using UiPath.UIAutomationNext.Enums;
namespace GoogleWorkspaceCodedWorkflows
{
    public class GetGoogleSheetColumnAsArray : CodedWorkflow
    {
        [Workflow]
        public void Execute()
        {
             var GoogleSheetName= "Contacts";
             var service = google.Sheets(connections.GoogleSheets.<connectionID>);
             var columnArray = GetDataFromSheet(service,GoogleSheetName);
            foreach(string item in columnArray)
            {
                Log(item);
            }
        }
        public static IEnumerable&lt;String&gt; GetDataFromSheet(IGoogleSheetsService googleSheets, string name)
        {
            var sheets = googleSheets.GetSpreadsheets();
            var testDataSheet = sheets.FirstOrDefault(s => s.Name.StartsWith(name));
            var dt = testDataSheet.GetSheets().First().ReadRange(true);
            foreach (DataRow row in dt.Rows)
            {
                yield return row[1].ToString();
            }
        }
    }
}
using GoogleWorkspaceCodedWorkflows.ObjectRepository;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using UiPath.CodedWorkflows;
using UiPath.Core;
using UiPath.Core.Activities.Storage;
using UiPath.Excel;
using UiPath.Excel.Activities;
using UiPath.Excel.Activities.API;
using UiPath.Excel.Activities.API.Models;
using UiPath.GSuite.Activities.Api;
using UiPath.GSuite.Sheets.Enums;
using UiPath.Mail.Activities.Api;
using UiPath.Orchestrator.Client.Models;
using UiPath.Testing;
using UiPath.Testing.Activities.TestData;
using UiPath.Testing.Activities.TestDataQueues.Enums;
using UiPath.Testing.Enums;
using UiPath.UIAutomationNext.API.Contracts;
using UiPath.UIAutomationNext.API.Models;
using UiPath.UIAutomationNext.Enums;
namespace GoogleWorkspaceCodedWorkflows
{
    public class GetGoogleSheetColumnAsArray : CodedWorkflow
    {
        [Workflow]
        public void Execute()
        {
             var GoogleSheetName= "Contacts";
             var service = google.Sheets(connections.GoogleSheets.<connectionID>);
             var columnArray = GetDataFromSheet(service,GoogleSheetName);
            foreach(string item in columnArray)
            {
                Log(item);
            }
        }
        public static IEnumerable&lt;String&gt; GetDataFromSheet(IGoogleSheetsService googleSheets, string name)
        {
            var sheets = googleSheets.GetSpreadsheets();
            var testDataSheet = sheets.FirstOrDefault(s => s.Name.StartsWith(name));
            var dt = testDataSheet.GetSheets().First().ReadRange(true);
            foreach (DataRow row in dt.Rows)
            {
                yield return row[1].ToString();
            }
        }
    }
}
  • Constructors
  • Methods
  • Examples

Was this page helpful?

Connect

Need help? Support

Want to learn? UiPath Academy

Have questions? UiPath Forum

Stay updated