Run AI Tests Using Google Sheets as Data Source
Connect Google Sheets to AI testing workflows for spreadsheet-based test case management and automated result reporting.
Why it matters
Enable teams to manage and execute AI prompt testing workflows by connecting Google Sheets as both an input source for test cases and an output destination for evaluation results, eliminating the need for manual test data management.
Outcomes
What it gets done
Import test cases and prompts directly from public or private Google Sheets
Execute AI model evaluations using spreadsheet-defined test parameters
Write evaluation results and performance metrics back to Google Sheets
Authenticate and sync with private Google Sheets using googleapis integration
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/pfoo-integration-google-sheets | bash Steps
Steps in the chain
Overview
Integration Google Sheets
Example configuration showing how to run promptfoo tests with test cases stored in Google Sheets When you want to store promptfoo test data in Google Sheets instead of local files
What it does
This example demonstrates how to use an external Google Sheet to run promptfoo tests. It shows how to configure promptfoo's testing framework to read test data from Google Sheets. The workflow supports both public sheets (no authentication required) and private sheets (using authenticated Google Sheets API access).
When to use - and when NOT to
Use this integration when you want to store test cases in Google Sheets rather than local files. It's useful when you prefer managing test data in a spreadsheet format.
Do NOT use this if you need version control for test cases (Git-based YAML files are better), or if your test data contains sensitive information that cannot be stored in Google Sheets even with private access controls.
Inputs and outputs
You provide a Google Sheets URL in your promptfooconfig.yaml file. For private sheets, you also provide Google API credentials. The workflow reads the sheet data and runs it through promptfoo's evaluation engine, then outputs test results that can be viewed in the promptfoo web interface or written back to Google Sheets.
Integrations
This workflow integrates with Google Sheets for test case storage and retrieval. Public sheet imports work without extra packages. Private sheet reads and Google Sheets output writes use the optional @googleapis/sheets package for authenticated access. It requires OpenAI API (you must set your OPENAI_API_KEY environment variable) for running the LLM evaluations.
Who it's for
This example is for users who want to run promptfoo evaluations using Google Sheets as their test data source.
Getting started
Initialize the example:
npx promptfoo@latest init --example integration-google-sheets
cd integration-google-sheets
For private sheet access, install the authenticated Sheets dependency:
npm install promptfoo @googleapis/sheets
Duplicate the Google Sheet referenced in promptfooconfig.yaml, replace the URL with your own sheet, set your OPENAI_API_KEY environment variable, then run:
npx promptfoo eval
View results with npx promptfoo view.
Source README
integration-google-sheets (Google Sheets)
You can run this example with:
npx promptfoo@latest init --example integration-google-sheets
cd integration-google-sheets
Usage
This example shows how to use an external Google Sheet to run tests. To get
started, set your OPENAI_API_KEY environment variable.
Next, duplicate the Google Sheet in promptfooconfig.yaml and replace the URL.
Public sheet imports work without extra packages. Private sheet reads and Google Sheets output writes use the optional authenticated Sheets dependency:
npm install promptfoo @googleapis/sheets
Then run:
npx promptfoo eval
Afterwards, you can view the results by running npx promptfoo view
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.