# table.data.convert

Convert table-shaped data between formats, and between the payload and a project store

# table.data.convert

```
table.data.convert --from FILE [--parse csv|json|ndjson|parquet] [--format csv|json|ndjson|parquet] [--rows] [--limit N] [--folder TEXT] [--filename TEXT] [--path TEXT] [--store TEXT] [--on-conflict error|skip|overwrite] → data
```

Convert table-shaped data between formats, and between the payload and a project store. `--from` is a store key, a FileRef (read from the store it names) or the rows themselves (`{{ input.query.rows }}`); `--parse csv|json|ndjson|parquet` says how it is read (default: from the key's extension, or JSON for rows). `--folder` / `--filename` / `--path` write a file, as `--format` (default: from the destination's extension, else csv); without a destination the rows are the answer. Adds `data: { …FileRef…, row_count, columns, parse, format, rows? }` — the FileRef fields only when a file is written, `rows` when there is no destination or `--rows` is set — and keeps the rest of the payload. `--limit N` converts the first N rows. This is how a query result becomes a downloadable CSV, and an uploaded CSV becomes rows a script can read.

## Flags

- `--from` (required): The table: a store key, a FileRef, or the rows themselves through {{ }}.
- `--parse`: How --from is read: csv, json, ndjson or parquet (default: from the key's extension, or JSON for rows).
- `--format`: What the written file is: csv, json, ndjson or parquet (default: from the destination's extension, else csv).
- `--rows`: With a destination, the answer carries the rows as JSON as well as the file (without one it always does).
- `--limit`: The most rows converted, from the first (default: all).
- `--folder`: Store folder for the written file (default: tables).
- `--filename`: Name of the written file (default: a UUID with the format's extension).
- `--path`: Exact store key for the written file; overrides --folder and --filename.
- `--store`: The project store to write to: `local`, or the id of an `s3` credential. Saved explicitly when the pipeline is registered (default: the project's default store at that moment)
- `--on-conflict`: When the target already exists: overwrite, skip or error (default: error)

## Examples

### Query result to a CSV download

```
| table.data.convert --from "{{ input.query.rows }}" --folder exports --filename orders.csv
```

It answers:

```json
{
  "data": {
    "__zf_type": "file_ref",
    "backend": "zebfs",
    "store": "local",
    "ref": "exports/orders.csv",
    "filename": "orders.csv",
    "mime": "text/csv",
    "kind": "csv",
    "size": 4120,
    "sha256": "sha256:…",
    "lifecycle": "durable",
    "origin": "table.data.convert",
    "trust": "generated",
    "row_count": 120,
    "columns": [
      "id",
      "total"
    ],
    "parse": "json",
    "format": "csv"
  }
}
```

### Uploaded CSV to rows

```
| table.data.convert --from "{{ $trigger.files.sheet }}" --parse csv --limit 500
```

After [`trigger.webhook`](/nodes/trigger/trigger.webhook.md) with a multipart field `sheet`; the next node reads `input.data.rows`. A CSV cell is text.

It answers:

```json
{
  "data": {
    "row_count": 2,
    "columns": [
      "name",
      "email"
    ],
    "parse": "csv",
    "rows": [
      {
        "name": "Ana",
        "email": "ana@example.com"
      },
      {
        "name": "Ben",
        "email": "ben@example.com"
      }
    ]
  }
}
```
