Help › Work with results

Export results to a file

Write every row of a result, the loaded rows or the selected rows to a CSV, TSV, JSON, JSON Lines, SQL or Excel file.

Querlyn 0.1.0 is not released yet. This help describes it ahead of release.

Exporting writes rows to a file. Unlike copying, it can write every row of a result, however large, because the rows go straight from the database to the file.

Export

  1. With a result showing, choose Export… in the bar above the grid, or File › Export Results… (⇧⌘E on macOS or Ctrl+Shift+E on Windows and Linux).

  2. Choose which rows:

    ChoiceWhat is written
    All rowsEvery row of the result. If they are not all loaded, Querlyn runs the statement again and writes the rows as they arrive.
    Only the … loaded (or shown, when a filter is on)The rows in the grid, in the order and with the filter you see.
    Only the … selectedThe rows of the selection.
  3. Choose the Format, and open Options if you want to change how it is written.

  4. Next to File, choose Choose… and say where to save.

  5. Choose Export.

Progress is shown as the rows are written, with a Cancel button. When it is done, a message names the file and how many rows it holds; File › Reveal Exported File shows the file in the Finder.

A file appears only when the export succeeded. If it fails or you cancel it, no file is written.

When all rows means running again

If the result is only partly loaded, All rows runs the statement again, on the tab's session. Know what that means:

  • The data may have changed since you ran the statement, so the file can differ from what the grid shows.
  • Functions that give a new answer each time, such as random numbers or the current time, run again.
  • It is offered only for a statement that just reads. For a statement that changes data, locks rows or cannot be read with certainty, All rows is unavailable and the dialog says why; export the loaded rows instead.
  • A statement with parameters runs with the values it had.

While the export runs, the tab's session is busy with it: the tab cannot run something else until it finishes or you cancel it (Query › Cancel Export).

Formats and their options

FormatOptions
CSV, TSVHeader row with column names; Delimiter (comma, semicolon, tab, pipe); Quotes (where needed, or every field); Line endings (LF or CRLF); NULL as (empty, the word NULL, or your own text); UTF-8 byte order mark (for Excel); Escape values Excel would treat as formulas
JSON, JSON LinesWrite every value as a string. Otherwise exact decimals stay numbers, binary data is written as base64 and dates in ISO 8601 form. JSON is one array; JSON Lines is one object per line.
SQL INSERTTable (the name to insert into) and Rows per INSERT. Names and values are written for the tab's database.
ExcelBold, frozen header row. Numbers Excel cannot hold exactly stay text. After 1,048,576 rows, the rows continue on further sheets.

Querlyn remembers the format and options you used last.

Formulas in CSV files

A spreadsheet treats a cell that starts with =, +, - or @ as a formula. If the data comes from people you do not know, a value could be written to do harm when the file is opened. Escape values Excel would treat as formulas puts an apostrophe before such values, so the spreadsheet shows them as text. It is off by default, because it changes the data in the file. Excel files are not affected: their cells are written as text or numbers.

Closing while an export runs

If you close the tab, disconnect or quit while an export is still running, Querlyn asks whether to cancel it (Cancel Export) or let it finish (Keep Running).

What is not exported

Help for Querlyn 0.1.0. All help topics