Back to Prisma in Excel
SheetXAI logo
Prisma logo
Prisma · Excel Guide

Run SELECT Queries Against a Prisma Database Into a Excel

2026-05-14
5 min read

The Scenario

Your VP of operations wants the last 90 days of revenue transactions pulled into an Excel workbook so the finance team can build a pivot table for the board meeting. The data is in your Prisma Postgres database. You are the only person on the team who knows how to run a psql query. The board meeting is in three hours.

The bad version:

  • Open your terminal, connect to the Prisma database with the connection string
  • Write the SELECT, run it, realize you forgot to add a date filter and the output is 18,000 rows
  • Add the WHERE clause, re-run, copy the terminal output
  • Paste into Excel, spend ten minutes fixing the column alignment and removing the row-count footer

That is thirty minutes you needed for the actual analysis. And the next time someone asks for an updated pull, you are back in the terminal.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent that lives inside your Excel workbook. It reads your workbook context, and through its Prisma integration it can query your database and land the results in your cells directly — no terminal, no psql.

Open the workbook your finance team is using and try:

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, column D: signup timestamps as readable dates
  • Headers written in row 1 so the pivot table can reference them immediately
  • Results ordered newest-first
  • If the query returns an error — invalid project ID, connection timeout — the error message appears in A2 so it is obvious rather than silent

What If the Data Is Not Quite Ready

The timestamp is coming back as an integer epoch rather than a date

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 in the Excel cells

I need to join with the subscriptions table to get MRR per user

Query my Prisma database: 'SELECT u.id, u.email, u.plan, s.mrr, 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 in this Excel sheet

Some plan values are mixed case and need normalizing before the pivot

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 with header in A1, then in column E write a label: "paying" if plan is pro or enterprise, "trial" otherwise

Run the query, join with subscriptions, calculate LTV, and sort in one shot

Connect to my Prisma database for project [ID], run 'SELECT u.id, u.email, u.plan, s.mrr, s.months_active 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, and in column F calculate LTV as mrr times months_active — sort by column F descending

The pattern: describe the query, the join, and the calculated column in one prompt so the workbook is pivot-table ready without a second pass.

Try It

Get the 7-day free trial of SheetXAI and open any Excel workbook where your finance or operations team needs live database output, then ask it to run a Prisma query and populate the table. See also the spoke on bulk SQL writes or the hub overview.

Stop memorizing formulas.
Tell your spreadsheet what to do.

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

Learn more