Exports that tell you what they lost

Notebook exports to HTML, PDF, Excel, Markdown and CSV from one report, with a fidelity report of what each format drops and redaction first.

By Updated

Every export lies a little. The PDF can't hover. A spreadsheet holds 15 significant digits, so a 19-digit order id doesn't survive as a number. The chart that was interactive in the app is a flat picture in the email. That's fine when you know it. It's a problem when the person reading the report doesn't, and the numbers they quote back to you aren't the numbers you sent.

So SQLly notebook exports tell you what they lost, before they write anything in the app and right after writing in the CLI. Below: how exports work, what each format keeps, and what never leaves your computer. Part eight of the notebooks series.

Exporting a notebook: one dialog for every format, a fidelity report of what the chosen format can't show, and a sensitive parameter's value left out before anything is written.

Real recording · typing sped up · Northwind demo data

The export dialog on the dashboard with the customer filter: switching formats, the fidelity report, and the sensitive value left out. Recorded in the app. Watch the whole recording, with chapters.

One report, many formats

Export ▸ Export… in the notebook's top bar opens the Export Notebook window. The formats are a web page (HTML), PDF, an Excel workbook, Markdown, CSV with one file per table, SVG or PNG with one image per chart, and clean notebook copies as .sqllynb or Jupyter .ipynb.

Every format is built from the same report. The notebook is turned into one document first, with its headings, tables, charts, KPI tiles and check results, and each format renders that document. That's why numbers, dates, titles and chart series match across all of them. Chart kinds the live grid engine doesn't draw, like box plots, heatmaps and waterfalls, are drawn in the app by the same SVG renderer the exports use. The live kinds are redrawn by that renderer when you export, so the series and labels match.

You choose what to include (the whole notebook, one dashboard with its arrangement, or selected cells), where the SQL goes (next to each result, in an appendix, or left out), whether to add where each result came from, and whether to use the current results or a saved run from the app, the CLI or a schedule. There are five layout templates too: executive summary, technical incident, audit, financial and operational. Each one decides the order, where SQL and sources go, and how many rows a table keeps. From a terminal, sqlly-cli notebook export with --dashboard and a dashboard's name exports that dashboard with its arrangement too.

The Export Notebook window with format, layout, scope, SQL placement, results and provenance options on one side and a preview listing the files it will create, what the format can't show and what will be removed
The Export window. The preview on the right is the fidelity report, shown before anything is written.

The fidelity report lists what the format can't show

Before anything is written, the preview lists the files it will create, What this format can't show, or "Everything carries over.", and what was removed. The notes are specific. A few of them, as the export shows them:

  • "A table shows the first 5,000 of 48,210 rows."
  • "A table shows 8 of its 14 columns to fit the page."
  • "Excel keeps 15 significant digits, so some values in Amount are rounded."
  • "Integers in Id are too large for an Excel number and were written as text."
  • "12 characters have no glyph in the PDF font and show as boxes (for example 日本)."
  • "A chart has too many categories to draw; 37 of them are grouped under Other."
  • "Excel has no time zones, so times with an offset in ShippedAt were converted to UTC."
  • "Linked cells no longer filter each other."

Here's roughly what each format gives up. HTML is one self-contained file with no scripts. Charts are inline SVG that follow light and dark, and dashboards keep their columns, stacking under 720 pixels. PDF is vector and paged, with repeated table headers, cells wrapped to three lines, columns past the page width dropped, and 5,000 rows per table unless the template says otherwise. Excel keeps all rows up to its sheet limits and keeps filters on data sheets, but charts are pictures next to the data, and numbers past 15 significant digits are rounded or written as text. Markdown writes an SVG file per chart on the desktop, and embeds the charts in one file in the browser. CSV has the data and nothing else.

Formula-looking text is handled per format too. In Excel it's quote-prefixed so it doesn't run, in CSV it gets a leading apostrophe, and in HTML and Markdown it's escaped. A cell that says =HYPERLINK(...) stays text.

Three chart cells drawn by the report renderer: a box plot of order line value by category, a monthly cohort retention grid and a calendar heatmap of orders per day in 2022
A box plot, a cohort grid and a calendar heatmap. These are drawn by the renderer the exports use, so an export draws the same charts.

Where each number came from can ride along

Tick Include where each result came from and every table carries its source: connection, database, environment, when it was read, the row count, the run id and a hash of the SQL. It's the same provenance every chart and table cell shows in the app. Cut-short tables say so in the export, and a chart drawn from truncated, sampled or partial data carries its badge inside the picture, so the warning survives in SVG, PNG, Excel and PDF. CSV notes the tables that hold only part of their result, cell errors become warning callouts, and AI findings keep their labels, with an unverified finding titled "Unverified".

A chart cell's Provenance panel open, showing the connection, database, environment, extraction time, run id, rows kept out of the total, completeness and a hash of the SQL
The provenance a chart shows in the app. Exports can carry the same details for every table.

What never leaves

Every export removes three things before rendering:

  • The values of parameters marked sensitive, wherever they appear, replaced with [redacted].
  • Columns marked sensitive, from tables and charts.
  • Anything that looks like a password, private key, access token or connection-string secret, in SQL, settings or results.

Notebook copies also leave out results, your personal parameter values and your computer's connection mappings, so connections keep only their names.

When an export finds something to remove, it stops at "This export contains sensitive data" and lists what will be removed or masked, with Export with these removed and Back. Leave out all row data drops every row and keeps the structure, SQL and checks, for when you want to share how a notebook works without sharing what it found. It also leaves out the numbers that come from the rows: row totals, failing-row counts, KPI status and notes, and AI findings that quote the data.

Files are written atomically, so a failed export leaves the old file as it was. Charts and CSV tables go next to the file you choose and nowhere else. Every export from the desktop app or the CLI is also written to the notebook audit log, with its format, what it covered and what was removed, never the data itself.

A confirmation in the Export window saying the export contains sensitive data, listing the items that will be removed or masked, with Export with these removed and Back buttons
An export that found sensitive data stops and lists what it will remove.

What's still rough

Excel charts are pictures, not native Excel charts. PDF text has no kerning or shaping, bold and italic are synthesized, there's no tagged (accessible) PDF, and the contents are PDF bookmarks instead of a printed contents page. The PDF font only covers Latin, Greek and Cyrillic, so CJK characters show as boxes and right-to-left scripts are drawn letter by letter. The export reports both, but that's a real gap for a lot of people, and SQLly's UI is translated into Japanese, Korean and Chinese. Most text SQLly adds to a report now follows the app's language, but an AI finding's "Unverified" title is still English.

PDF and PNG aren't available in the browser build, where the Export menu downloads each format directly with the dialog's defaults.

The full fidelity table, per format and per row, is on Exporting and the fidelity report. The next post is about running notebooks on a schedule, which is where unattended exports start to matter. If an export ever drops something without listing it, that's a bug, and I'd like the file.