This guide explains how to set up a Google Cloud Platform service account for accessing your Google Sheets LIMS database.
- Go to Google Cloud Console
- Create a new project or select an existing one
- Note your project ID
- In the Google Cloud Console, go to APIs & Services > Library
- Search for and enable the following APIs:
- Google Sheets API
- Google Drive API
- Go to APIs & Services > Credentials
- Click Create Credentials > Service Account
- Fill in the service account details:
- Name:
lims-sync-service - Description:
Service account for LIMS Google Sheets sync
- Name:
- Click Create and Continue
- Skip the optional permissions steps
- Click Done
- In the Credentials page, find your new service account
- Click on the service account email
- Go to the Keys tab
- Click Add Key > Create New Key
- Select JSON as the key type
- Click Create
- A JSON file will be downloaded to your computer
- Create a
credentialsdirectory in your AISynbioPipeline project root:mkdir credentials
- Rename the downloaded JSON file to
service_account.json - Move it to the
credentialsdirectory:credentials/service_account.json - IMPORTANT: Never commit this file to version control (the credentials/ directory is in .gitignore)
- Open your Google Sheets LIMS spreadsheet
- Click the Share button
- Copy the service account email from the JSON file (it looks like:
lims-sync-service@your-project.iam.gserviceaccount.com) - Paste it into the share dialog
- Set permission to Viewer (the API only needs read access)
- Uncheck "Notify people" (the service account doesn't need notification)
- Click Share
- Open
aisynbiopipeline/limsapi/config.json - Update the
spreadsheet_idfield with your Google Sheets ID:- The spreadsheet ID is in the URL:
https://docs.google.com/spreadsheets/d/{SPREADSHEET_ID}/edit - For example, if your URL is
https://docs.google.com/spreadsheets/d/1Rs5WeIy4bXRKL6DRJ41S3_NAc8JUHdeL7oDya5JEvE4/edit - Your spreadsheet ID is:
1Rs5WeIy4bXRKL6DRJ41S3_NAc8JUHdeL7oDya5JEvE4
- The spreadsheet ID is in the URL:
Run a manual sync to test everything is working:
./lims.sh syncIf successful, you should see output showing tables being synced.
- Make sure
service_account.jsonis in thecredentials/directory - Check the
credentials_filepath inconfig.json(should becredentials/service_account.json)
- Make sure you shared the spreadsheet with the service account email
- Check that the service account has at least Viewer permission
- Make sure you enabled Google Sheets API and Google Drive API in your Google Cloud project
- Wait a few minutes and try again
- Double-check the spreadsheet ID in
config.json - Make sure the spreadsheet hasn't been deleted
- Verify the service account has access
- Never commit credentials to version control (the
credentials/directory is in .gitignore) - Store the file securely and restrict file permissions:
chmod 600 credentials/service_account.json
- Only grant the minimum required permissions (Viewer is enough for read-only sync)
- Rotate service account keys periodically
- Monitor service account usage in Google Cloud Console
- Use different service accounts for different environments (dev, staging, prod)
Once the service account is set up and working:
- Start the sync daemon:
./lims.sh daemon start - Check sync status:
./lims.sh status - Query your data:
./lims.sh listand./lims.sh query <table_name>