⭐️ Querying tabular data files

Moment treats CSV and SQLite files as first-class data sources you can query with SQL. Drop a file into the document, create a request page that points at it, and the result flows into your code cells just like any other request — no ETL, no glue code, no separate database to spin up.

Directly querying a CSV

Create a request page with type: sqlite, point filePath at the CSV, and write a query against the data table.

See the working example at the bottom of this section.

Calling the request from a code cell

Any SQLite request page is invoked from JavaScript exactly like an HTTP or Postgres request page:

In a downstream cell, branch on data?.kind and read data.rows:

Parameterizing queries

Use {{vars.X}} placeholders in the SQL and pass values via query() or mutation():

Try it

Edit salesByRegion's SQL to slice by product instead of region, or add a WHERE clause — the table updates as soon as you save.

Drop another CSV into .moment/attachments/ and create a sibling request page that points at it. The pattern is identical.

Swap the bar-row for any visualization you like; the React cell only needs salesRows.