Module 08Lesson 2

Lesson 2. Google Sheets as a Database

Hands-on: Zapier

Lesson 2. Google Sheets as a Database#

Goal: learn how to organize data in Google Sheets for agent integration.

Why Google Sheets Is a Good Starting Point#

  • familiar interface (like Excel)
  • free up to 10 million cells per document
  • API for reading and writing
  • easy integration with Zapier, Make, n8n
  • collaborative editing

How a Table for an Agent Should Be Structured#

The agent treats the sheet like a database, so:

  1. Row 1 is column headers (field names)
  2. Each following row is one record (customer, order, task)
  3. Columns have a clear format (text, number, date, yes/no)
  4. No empty rows or columns in the middle of the table
  5. No merged cells or extra formatting

Example: "Customers" Table#

IDNameEmailPhoneStatusRegistration Date
1Ivan Petrovivan@example.com+79001234567Active2026-01-15
2Maria Sidorovamaria@example.com+79007654321Lead2026-01-20
3Alexey Kovalevalex@example.com+79009876543Inactive2025-12-10

What matters:

  • ID — unique record number (so you don't mix up two Ivan Petrovs)
  • Data format — phone always in one format, date in YYYY-MM-DD
  • Status — only three values (not "active," "Active," "active")
  • No empty rows between records

How to Connect Google Sheets to an Agent#

Step 1. Prepare the sheet

  • fill row 1 with headers
  • ensure there are no empty rows or columns
  • check data formats (dates, numbers, text)

Step 2. Set sharing

  • click "Share" → "Anyone with the link" (or grant access to a service account)
  • if using API — create a service account in Google Cloud Console (for advanced setups)

Step 3. Connect via integration

  • in Zapier / Make / n8n select the "Google Sheets" module
  • authorize (grant access to the sheet)
  • choose document and sheet
  • configure action: "Read rows," "Add row," "Update row"

Step 4. Test

  • run a test — confirm data is read and written correctly
  • verify new rows are appended to the end, not inserted randomly

Common Google Sheets Mistakes#

MistakeWhy it's a problemHow to fix
Empty rows inside the tableAgent can't tell where data endsRemove all empty rows between records
Merged cellsAPI can't read the structureUnmerge cells, use one cell per field
Mixed formats in one column"+7 900 123-45-67" and "89001234567" are differentUse a single format
No headersAgent doesn't know what each column meansAdd a first row with field names
Formulas in cellsAPI reads the formula, not the resultCopy values, not formulas

Practical Example: Lead Qualification Bot#

Task: a customer writes to a Telegram bot; the bot checks if the customer exists in a Google Sheets base.

"Customers" table:

EmailNameStatusLast Contact Date
ivan@example.comIvanActive2026-01-30
maria@example.comMariaLead2026-01-25

Agent logic:

  1. Customer enters email in the bot
  2. Agent queries Google Sheets: "Find row where Email = [entered email]"
  3. If found → agent replies: "Hello, [Name]! Your status: [Status]"
  4. If not found → agent replies: "You're a new customer. Shall we register you?"
  5. If customer agrees → agent adds a new row to the table

Tools: Zapier (for the chatbot) + Google Sheets (for data) + integration via API or Zapier.