Component Libraries •
Project Templates
Docs •
Install •
Tutorials •
Developer Guides •
Contribute •
Blog •
Discord
Xircuits Component Library for GSpread – Simplify your Google Sheets operations directly in Xircuits workflows.
Integrate Google Sheets functionalities into Xircuits workflows effortlessly. Perform operations like spreadsheet creation, cell updates, and worksheet management using the GSpread library.


Before you begin, you will need:
- Python 3.9+.
- Xircuits installed.
- Google Service Account JSON key for authentication.
Authenticates using a Google Service Account JSON key and initializes a GSpread client.

Opens a Google Spreadsheet by its title and selects a specified worksheet or defaults to the first worksheet.

Opens a Google Spreadsheet using its URL and selects a worksheet.
Selects a worksheet by its title or defaults to the first worksheet.
Creates a new Google Spreadsheet and optionally shares it with an email.
Adds a new worksheet to an existing spreadsheet with customizable rows and columns.
Updates a range of cells in the worksheet with specified values.
Retrieves all values from a worksheet as a list of lists.
Retrieves all records from a worksheet as a list of dictionaries.
Finds all cells containing a specific string value.
Finds all cells matching a specified regular expression.
We have provided example workflows to help you get started with the GSpread component library. These examples demonstrate how to authenticate, read, and update Google Sheets within a Xircuits workflow.
This example demonstrates how to authenticate, read a cell's value, and update it with new data.
To use this component library, ensure that you have an existing Xircuits setup. You can then install the GSpread library using the component library interface, or through the CLI using:
xircuits install gspread
Alternatively, you can install it manually by cloning and installing it:
# base Xircuits directory
git clone https://github.com/XpressAI/xai-gspread xai_components/xai_gspread
pip install -r xai_components/xai_gspread/requirements.txt
To access spreadsheets via Google Sheets API, you need to authenticate and authorize your application. If you plan to access spreadsheets on behalf of a bot account, use a Service Account. Below are the steps to set up service credentials.
- Enable API Access:
- Go to Google Developers Console and create a new project (or select an existing one).
- In "Search for APIs and Services," enable both "Google Drive API" and "Google Sheets API."
- Create Service Account Credentials:
- Navigate to "APIs & Services > Credentials" and click "Create credentials > Service account key."
- Fill out the form and select JSON key type.
- Download the JSON file containing your credentials.
- Share Spreadsheet Access:
- Share your spreadsheet with the
client_email
listed in the JSON file.
- Share your spreadsheet with the
- Configure Credentials:
- Place the downloaded JSON file in a location accessible to your application.
- Optionally, move the file to
~/.config/gspread/service_account.json
(Linux/Mac) or%APPDATA%\gspread\service_account.json
(Windows).
For more details, refer to the GSpread Authentication Guide.
- Ensure the Google Service Account is shared with the spreadsheets you intend to access.
- Keep your JSON key secure and do not expose it publicly.