ballerinax/googleapis.sheets Ballerina library

3.0.0

Overview

The Ballerina connector for Google Sheets makes it convenient to implement some of the most common use cases of Google Sheets. With this connector, you can programmatically manage spreadsheets, manage worksheets, perform CRUD operations on worksheets, and perform column-level, row-level, and cell-level operations.

This module supports Google Sheets API v4.

Prerequisites

Before using this connector in your Ballerina application, complete the following:

Quickstart

To use the Google Sheets connector in your Ballerina application, update the .bal file as follows:

Step 1: Import connector

Import the ballerinax/googleapis.sheets module into the Ballerina project.

Copy
import ballerinax/googleapis.sheets as sheets;

Step 2: Create a new connector instance

Create a sheets:ConnectionConfig with the OAuth2 tokens obtained, and initialize the connector with it.

Copy
sheets:ConnectionConfig spreadsheetConfig = {
    auth: {
        clientId: <CLIENT_ID>,
        clientSecret: <CLIENT_SECRET>,
        refreshUrl: sheets:REFRESH_URL,
        refreshToken: <REFRESH_TOKEN>
    }
};

sheets:Client spreadsheetClient = check new (spreadsheetConfig);

Step 3: Invoke connector operation

  1. Now you can use the operations available within the connector. Note that they are in the form of remote operations.

    Following is an example on how to create a spreadsheet using the connector.

    Create Spreadsheet with given name

    Copy
    public function main() returns error? {
        sheets:Spreadsheet response = check spreadsheetClient->createSpreadsheet("NewSpreadsheet");
        log:printInfo("Successfully created spreadsheet!");
    }
  2. Use bal run command to compile and run the Ballerina program.

You can find a list of samples here

Import

import ballerinax/googleapis.sheets;Copy

Metadata

Released date: almost 2 years ago

Version: 3.0.0

License: Apache-2.0


Compatibility

Platform: java11

Ballerina version: 2201.0.3


Pull count

Total: 121872

Current verison: 14302


Weekly downloads


Source repository


Keywords

Productivity/Spreadsheets

Cost/Free

Vendor/Google


Contributors

Other versions

See more...