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

Pull Daily Active User Trends From ClickHouse Into a Google Sheet

2026-05-14
5 min read

The Scenario

Your team runs a weekly product review every Monday at 10 AM. The ritual involves the same chart: 90 days of daily active users, pulled from the events table in ClickHouse.

Last week, someone noticed the chart in the shared Google Sheet was three weeks old. The person who usually updates it had been out. The PM had walked into the review citing stale numbers, and a stakeholder who does check the dates caught it mid-meeting.

The bad version of updating this chart yourself:

  • Export a CSV from the ClickHouse Play UI, fix the date column format so Google Sheets doesn't read it as text, and import it — overwriting the previous range.
  • Manually shift the chart data range because the new export came out with a slightly different row count than the last one.
  • Realize the chart title still says "Last Updated: April 3" and update that by hand too.

None of that is technically hard. But it's also not the analysis work you're paid to do. And it's certainly not how you want to spend Sunday evening.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent that lives inside your Google Sheet. It reads what's already there, connects to ClickHouse through its built-in integration, and writes the query result directly into your sheet. No CSV export. No import wizard. No column realignment.

Run this query on my ClickHouse database and write the results starting at A2: SELECT toDate(timestamp) as date, count(distinct user_id) as DAU FROM events WHERE timestamp >= today() - 90 GROUP BY date ORDER BY date

What You Get

  • A header row at A1 with date and DAU labels.
  • 90 rows of results written starting at A2, one row per day, ordered ascending.
  • Date values in a format Google Sheets recognizes as dates — the chart range updates automatically.
  • If the query returns fewer rows than the previous pull (a sparse recent day, for example), SheetXAI notes the row count in the sidebar before writing.

What If the Data Is Not Quite Ready

The timestamp column stores microseconds, not seconds

Run this ClickHouse query and write results to A2: SELECT toDate(fromUnixTimestamp64Micro(timestamp)) as date, count(distinct user_id) as DAU FROM events WHERE fromUnixTimestamp64Micro(timestamp) >= today() - 90 GROUP BY date ORDER BY date — then label the headers in row 1.

The events table has multiple event types and you only want 'page_view'

Query ClickHouse: SELECT toDate(timestamp) as date, count(distinct user_id) as DAU FROM events WHERE timestamp >= today() - 90 AND event_type = 'page_view' GROUP BY date ORDER BY date — write results to column A and B starting at A2.

The sheet already has data and you want to write to a specific tab

On the tab named "DAU Data", clear the range A2:B200, then run this ClickHouse query and write the results starting at A2: SELECT toDate(timestamp) as date, count(distinct user_id) as DAU FROM events WHERE timestamp >= today() - 90 GROUP BY date ORDER BY date.

Full refresh: check the most recent date in the sheet and only pull missing days

Check what the most recent date is in column A of the "DAU Data" tab. Then query ClickHouse for DAU by day from that date through today and append the new rows below the last entry — skip any date that already exists in the sheet.

The general pattern: describe the state of the sheet and the desired outcome together. SheetXAI handles the conditional logic so you don't have to.

Try It

Get the 7-day free trial of SheetXAI and open the Google Sheet where your DAU chart lives, then ask it to pull the latest 90 days from ClickHouse and write them in. You can also explore the multi-table reporting spoke or the full ClickHouse integration overview.

Stop memorizing formulas.
Tell your spreadsheet what to do.

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

Learn more