Back to Prisma in Google Sheets
SheetXAI logo
Prisma logo
Prisma · Google Sheets Guide

Run SELECT Queries Against a Prisma Database Into a Google Sheet

2026-05-14
5 min read

The Scenario

It's Thursday afternoon and your head of growth has sent a Slack message asking for a cohort breakdown — signups by plan type since January, sorted by date. The data is in your Prisma Postgres database. You know the table. You can picture the columns. But you're a backend developer, not a data analyst, and you've been context-switching all day between three open PRs.

The bad version:

  • Open your Prisma console, navigate to the right project, remember whether the column is called created_at or signup_date
  • Run the SELECT, realize the output truncates at 25 rows, add LIMIT 1000, re-run
  • Copy the terminal output, paste into a sheet, delete the row-count line, manually fix the column spacing

That's twenty minutes you didn't have. The growth team needs this by 4 PM. And next week they'll ask again.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent that lives inside your Google Sheet. It reads your spreadsheet, understands the context, and through its built-in Prisma integration it can query your databases and land the results in your cells directly. No psql. No terminal tab-switching.

Open a blank sheet or the one your growth team already uses for cohort data, then try this:

Connect to my Prisma database for project [ID] and run 'SELECT id, email, plan, created_at FROM users WHERE created_at > 2025-01-01 ORDER BY created_at DESC' — paste the results starting at A2 with headers in A1

What You Get

  • Column A: user IDs, column B: email addresses, column C: plan type (free, pro, enterprise), column D: signup timestamps formatted as readable dates
  • Headers written in row 1, data starting in row 2
  • Rows ordered newest-first so the most recent signups are visible without scrolling
  • If the query returns zero rows for a filter value, the sheet shows an empty result rather than silently writing nothing

What If the Data Is Not Quite Ready

The timestamp column is returning raw epoch integers instead of readable dates

Connect to my Prisma database for project [ID] and run 'SELECT id, email, plan, TO_TIMESTAMP(created_at) as signup_date FROM users WHERE created_at > 1735689600 ORDER BY signup_date DESC' — write results to A2 with headers in A1, format column D as YYYY-MM-DD

The plan column has mixed-case values that need normalizing

Query my Prisma database: 'SELECT id, email, LOWER(plan) as plan, created_at FROM users WHERE created_at > 2025-01-01 ORDER BY created_at DESC' — paste to A2, header in A1, then in column E write a label: "paying" if plan is pro or enterprise, "trial" otherwise

I need to join against a subscriptions table to get current status

Query my Prisma database: 'SELECT u.id, u.email, u.plan, s.status, u.created_at FROM users u LEFT JOIN subscriptions s ON s.user_id = u.id WHERE u.created_at > 2025-01-01 ORDER BY u.created_at DESC' — write to A2 with headers in A1

Run the query, flag churned accounts, and sort by most recent signup in one shot

Connect to my Prisma database for project [ID], run 'SELECT u.id, u.email, u.plan, s.status, u.created_at FROM users u LEFT JOIN subscriptions s ON s.user_id = u.id WHERE u.created_at > 2025-01-01', write to A2 with headers in A1, then in column F mark "churned" where status is cancelled and "active" otherwise, sort by created_at descending

The pattern: ask for the query, the formatting, and the conditional labeling in one prompt. SheetXAI handles the SQL and the writeback together.

Try It

Get the 7-day free trial of SheetXAI and open any sheet where your team tracks user data, then ask it to pull a fresh cohort snapshot from your Prisma database. From there, see the sibling spoke on bulk SQL writes or check the hub overview for all Prisma workflows.

Stop memorizing formulas.
Tell your spreadsheet what to do.

Join 4,000+ professionals saving hours every week with SheetXAI.

Learn more