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

Run Parameterized ClickHouse Queries From Cell Inputs in a Google Sheet

2026-05-14
5 min read

The Scenario

You are the product manager for a B2B SaaS platform. Every week, a stakeholder in customer success asks you the same question with slightly different parameters: "What's the funnel conversion rate for [country] between [date] and [date]?"

You've answered this question 11 times in the last three months. Each time, you go to the ClickHouse Play UI, edit the WHERE clause, run the query, copy the output, paste it into a Google Sheet, and send a screenshot. The query takes about four minutes round-trip if nothing goes wrong.

The bad version of the twelfth time:

  • Find last week's query in your browser history, edit the date range and country parameter, and run it.
  • Realize you changed the wrong date and the result set looks wrong, so run it again.
  • Copy the result, open the existing tracking sheet, paste it below the previous run, and manually add a label row for the parameters you used.

You're not doing analysis. You're running a manual query interface.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent that lives inside your Google Sheet. You type the filter parameters into cells — date range in B1:B2, country in B3 — and then tell SheetXAI to run the ClickHouse query using those cell values. The results land in the sheet below. Next week, update the cells and ask again.

Run a ClickHouse query filtering events to the date range in cells B1:B2 and the country in cell B3, then write the funnel step name and conversion rate for each step into columns A and B starting at row 6.

What You Get

  • The date range and country are read from B1:B2 and B3 at query time — change the cells, re-run the prompt, get fresh results.
  • Funnel step names in column A, conversion rates in column B, starting at row 6.
  • Each run drops results into the same range, so a chart built on A6:B20 stays current without any manual adjustments.
  • If the country in B3 has no matching events for the date range, SheetXAI writes a note in A6 rather than silently producing an empty result.

What If the Data Is Not Quite Ready

The date cells contain full datetime strings instead of plain dates

Read the start date from B1 and end date from B2, treating them as UTC datetimes. Run this ClickHouse funnel query: SELECT step, countIf(converted = 1) / count() as conversion_rate FROM funnel_events WHERE timestamp BETWEEN B1 AND B2 AND country = B3 GROUP BY step ORDER BY step — write results to A6:B20.

The country field in ClickHouse uses ISO codes, but B3 contains a full country name

Read the country from B3. Look up its ISO 3166-1 alpha-2 code (e.g., 'Germany' → 'DE') and use that in the ClickHouse query WHERE country = '<code>'. Write the funnel step and conversion rate starting at row 6.

You want to compare two countries side by side in the same sheet

Read the date range from B1:B2. Run the funnel query twice — once for the country in B3, once for the country in C3. Write the results side by side: step names in column A, first country conversion rates in column B, second country rates in column C. Start at row 6.

Full on-demand report: pull, label, and flag any step below 20% conversion

Read dates from B1:B2 and country from B3. Query ClickHouse for the funnel conversion rates. Write step name, conversion rate, and a flag column: 'Needs attention' if conversion is below 20%, 'On track' otherwise. Label the parameter values used in row 4.

One prompt covers the parameter read, the query, the logic, and the output — no find-and-replace in a SQL editor every time the ask changes.

Try It

Get the 7-day free trial of SheetXAI and open the Google Sheet where you track funnel data, type your parameters into cells, then ask SheetXAI to pull the matching ClickHouse results. See also the DAU trend spoke or the full ClickHouse overview.

Stop memorizing formulas.
Tell your spreadsheet what to do.

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

Learn more