Private Google Sheet

Connect private Google Sheets to Memex using service account authentication.

When to Use This Connector

Use the Private Google Sheet connector when you have a Google Sheet that:

  • Contains sensitive or confidential data

  • Is shared only with specific people

  • Requires authentication to access

If your sheet is publicly accessible (shared with "Anyone with the link"), use the simpler Public Google Sheet connector instead.

circle-exclamation

What You'll Need

To connect a private Google Sheet, you'll need:

Credential
Description

Spreadsheet URL

The full URL of your Google Sheet

Service Account JSON

A JSON key file from Google Cloud Platform

Setting Up Access

This connector requires a Google Cloud service account that has been granted access to your spreadsheet. Here's how to set it up:

Step 1: Create a Google Cloud Project

  1. Click Select a projectNew Project

  2. Enter a Project name (e.g., "Memex Sheets Access")

  3. Click Create

Step 2: Enable the Google Sheets API

  1. Go to APIs & ServicesLibrary

  2. Search for "Google Sheets API"

  3. Click on it and press Enable

Step 3: Create a Service Account

  1. Go to IAM & AdminService Accounts

  2. Click Create Service Account

  3. Enter a Name (e.g., "Memex Sheets Reader")

  4. Click Create and Continue

  5. For the role, select Viewer (basic read access)

  6. Click Continue, then Done

Step 4: Create and Download the JSON Key

  1. Click on the service account you just created

  2. Go to the Keys tab

  3. Click Add KeyCreate new key

  4. Select JSON format

  5. Click Create

The JSON key file will download automatically. Note the client_email field—you'll need it in the next step.

circle-info

The client_email in your JSON file looks like: [email protected]

You'll need to share your Google Sheet with this email address.

Step 5: Share Your Google Sheet with the Service Account

This is a crucial step—your service account needs permission to access the sheet:

  1. Open your Google Sheet in a browser

  2. Click the Share button (top-right corner)

  3. Paste the service account email (the client_email from your JSON key)

  4. Set the permission to Viewer (or Editor if you need write access)

  5. Uncheck "Notify people" (service accounts can't receive emails)

  6. Click Share

circle-exclamation

Connecting to Memex

  1. Open the Memex Hub from the sidebar

  2. Click on the Connectors tab

  3. Click on the Private Google Sheet card

  4. Enter a Connection Name (e.g., "Sales Data Sheet")

  5. Paste your Spreadsheet URL (the full URL from your browser)

  6. Open your downloaded JSON key file in a text editor

  7. Copy the entire contents and paste into the Service Account JSON field

  8. Click Add Connection

Your private Google Sheet is now connected! Memex can access it across all your conversations.

Verifying Your Connection

After connecting, try asking Memex:

If Memex returns your data, the connection is working correctly.

Using Your Connection

Once connected, you can ask Memex to work with your spreadsheet data:

Working with Multiple Sheets

If your spreadsheet has multiple tabs (worksheets), you can specify which one to query:

By default, Memex will read from the first sheet if you don't specify a tab name.

Security Considerations

Service Account Access

The service account only has access to sheets explicitly shared with it. It cannot:

  • Access other sheets in your Google account

  • See your Google Drive contents

  • Access any data you haven't shared with it

Sharing Best Practices

  • Share sheets with Viewer permission unless Memex needs to write data

  • Only share specific sheets, not entire folders

  • Review shared access periodically in your sheet's sharing settings

circle-info

Read vs. Write Access

When you share your sheet with the service account:

  • Viewer permission allows Memex to read data only

  • Editor permission allows Memex to read and write data

Only grant Editor access if you want Memex to be able to update your spreadsheet.

Key Security

  • Once connected, you can delete the JSON key file from your downloads—Memex stores the credentials securely

  • Never commit service account keys to version control

  • If compromised, delete the key in Google Cloud Console and create a new one

circle-info

You can revoke access anytime by removing the service account email from your sheet's sharing settings.

Troubleshooting

You can ask the Memex agent to help troubleshoot, but here are a few common problems:

"Permission denied" or "Spreadsheet not found" Error

This almost always means the sheet hasn't been shared with the service account:

  1. Open your Google Sheet

  2. Click Share

  3. Verify the service account email is listed with at least Viewer access

  4. If not, add it and try connecting again

"Invalid JSON" Error

  • Make sure you copied the entire contents of the JSON file

  • Check that you didn't accidentally include extra characters

  • Verify the JSON is properly formatted

"Google Sheets API has not been enabled" Error

  1. Select your project

  2. Go to APIs & ServicesLibrary

  3. Search for "Google Sheets API" and enable it

  4. Wait a few minutes and try again

Can't Find the Service Account Email

Open your JSON key file and look for the client_email field:

Copy this email address and use it to share your sheet.

Learn More

Last updated

Was this helpful?