Save rows to a file or the clipboard
Writes a list of rows as CSV, TSV, JSON, JSON Lines or a Markdown table, or puts them on the clipboard as a table.
Save rows to to
Details #
rows is a list of objects (such as {{ res.rows }} from Scrape a page into rows). The columns are the keys, in the order they first appear. The format follows the path's extension (.csv, .tsv, .json, .jsonl, .md) when format is left out.
append adds to the file instead of replacing it. With key it upserts: a row whose key column is already in the file replaces that row, so a nightly scrape grows one file without duplicates. New columns are added at the right.
to: clipboard puts tab-separated text on the clipboard, which pastes into Numbers or Excel as a table.
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
rows | any value | Yes | Required. | |
to | text | Yes | A path (~ works), or clipboard. Required. | |
append | yes / no | |||
format | one of | csv tsv json jsonl markdown | , append, key. | |
into | text | The variable that receives {path, count, added, updated}. | ||
key | text | |||
sample | any value |
Every step also accepts label, onFailure, timeout and dryRunSafe.
Examples #
- Scrape “selection” into res
- Save rows to the clipboard
Gotchas #
Appending to a file in another format than its extension is refused.
Values that are lists or objects are written as JSON text in a CSV cell.