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

Create PostHog Warehouse Saved Queries From an Excel workbook

2026-05-15
5 min read

The Scenario

A data team is migrating 20 analytics queries into PostHog's data warehouse. The HogQL for each — session analysis, funnel conversions, cohort overlap — is reviewed and ready in an Excel workbook: query name in column A, HogQL in column B. The task is to register all 20 as PostHog warehouse saved queries so the rest of the team can access them from PostHog. The last migration someone did this way through the UI took a morning and produced three query name typos that had to be hunted down during a dashboard audit two weeks later.

The bad version:

  • Open PostHog's data warehouse section, click "New saved query," paste query name from row 1, paste HogQL from the same row, save — repeat 19 more times
  • Reach query 9 and find that the HogQL includes a string literal with a single-quote — pasting it into the UI works, but you spend 15 minutes verifying the API will handle it before continuing
  • Finish all 20, check PostHog's saved query list, discover query 14 has a truncated name because you accidentally hit enter mid-paste and PostHog saved only the first line

Twenty queries, one UI session per query, with a truncation risk hiding in every complex HogQL string.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent inside your Excel workbook. It reads your query definition table and calls PostHog's warehouse saved query create endpoint for each row — writing returned query IDs into column C.

Read all 20 query definitions from the 'Warehouse Queries' tab — name column A, HogQL column B — and create PostHog warehouse saved queries for each, writing IDs back into column C.

What You Get

  • PostHog creates one saved query per row using the exact name and HogQL from the workbook
  • Column C receives the returned query ID for each row — your record linking each definition to its live PostHog query
  • Rows that fail get an error note in column C

What If the Data Is Not Quite Ready

HogQL has multi-line formatting

Before creating PostHog warehouse saved queries, normalize column B: collapse multi-line HogQL into single-line strings by replacing newlines with a space. Then create a saved query for each row and write returned IDs into column C.

Some HogQL cells are blank

For each row in the 'Warehouse Queries' worksheet where column B (HogQL) is not empty, create a PostHog warehouse saved query using name from column A and HogQL from column B. Write IDs into column C. Write "Skipped - blank HogQL" in column C for rows with an empty column B.

Queries are split across two worksheets

Combine all rows from the 'Funnel Queries' worksheet and the 'Retention Queries' worksheet (each with name in column A, HogQL in column B). Create PostHog warehouse saved queries for all combined rows. Write returned IDs back into column C of the respective source worksheet.

Create all queries and build a linked reference index

Create PostHog warehouse saved queries for all rows in the 'Warehouse Queries' worksheet (name column A, HogQL column B). Write returned query IDs into column C. Then create a 'Query Index' worksheet with three columns: query name, ID, and a PostHog URL as https://us.posthog.com/data-warehouse/[query-id]. Sort alphabetically by query name.

Create all queries and produce a linked index — one prompt.

Try It

Get the 7-day free trial of SheetXAI and open the Excel workbook where your HogQL definitions are staged, ask it to register all of them as PostHog warehouse saved queries, and hand the ID list to the team before the sprint ends. Also see: Create PostHog Batch Export Configurations From an Excel workbook and the PostHog hub.

Stop memorizing formulas.
Tell your spreadsheet what to do.

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

Learn more