---
title: "Google Sheets - Documentation"
description: "Use Google Sheets as a data source. AI for Database reads your spreadsheets and lets you query them with natural language."
canonical: "https://www.aifordatabase.com/docs/google-sheets/"
---

# Google Sheets

beginner 4 min read

## Connecting Google Sheets

Google Sheets is the easiest way to get started with AI for Database if your data lives in spreadsheets. AI for Database treats each sheet as a table and each column header as a field.

### Step 1: Authorize Google

Navigate to **Settings > Connections > Add Connection** and select Google Sheets. Click **Connect with Google** and sign in with the Google account that has access to your spreadsheets.

AI for Database requests read-only access to your Google Sheets. We never modify your spreadsheets.

### Step 2: Select Spreadsheets

After authorization, you will see a list of your recent spreadsheets. Select the ones you want to query. You can also paste a spreadsheet URL directly.

Each sheet tab in the spreadsheet becomes a queryable table. The first row is treated as column headers.

### Step 3: Query Your Data

Once connected, ask questions like:

*   "What is the total budget across all departments?"
*   "Show me rows where status is 'Pending' and amount is over $5,000"
*   "Which salesperson has the highest total sales this quarter?"

AI for Database translates these into SQL-like queries against your sheet data.

### Data Formatting Tips

For best results:

*   **Use clear column headers** in the first row. Avoid merged cells.
*   **Keep data types consistent** within each column (all numbers, all dates, etc.).
*   **Avoid blank rows** in the middle of your data range.
*   **Use named ranges** if you only want the AI to see a portion of a sheet.

### Refresh Behavior

Google Sheets data is cached for 5 minutes by default. When you run a query, you are guaranteed to see data no more than 5 minutes old. You can click **Refresh** to force a fresh read.

### Limitations

*   Maximum 10,000 rows per sheet for optimal performance. Larger sheets will work but may be slower.
*   Formulas are evaluated before the data reaches AI for Database -- you see the computed values, not the formulas.
*   Google Sheets connections do not support joins across different spreadsheets in a single query.

Source: https://www.aifordatabase.com/docs/google-sheets/
