Skip to content
Margent
Language
All guides

CSV tables

For owners · A sortable table for every CSV, with comments on a cell, a row or a column.

A table for every CSV

Upload .csv and .tsv files as they are, and Margent shows each as a table: data/members.csv becomes data/members.csv.html. Readers can sort and filter it, but not edit it. The file itself stays in the build, so it can still be downloaded.

Comments go on a cell, a whole row or a whole column. Each one records the row and the line in the file, so your agent finds the record in the CSV.

How the file is read

  • The first row names the columns. Empty names become “column 3”, and repeated names get a number.
  • The delimiter is detected: comma, semicolon, tab or pipe. .tsv files are always tab-separated.
  • Quoted fields can contain delimiters and line breaks, and rows may have different lengths.
  • The file should be UTF-8. Files that aren’t are read as Windows-1252, the encoding of Excel exports on Windows.
  • Up to 50 MB, 500 columns and 5 million rows. A larger file is not shown as a table, but can still be downloaded. Rows load as you scroll, and sorting and filtering run on the server, so large tables stay quick.

Parquet files

.parquet files are shown the same way: data/survey.parquet becomes data/survey.parquet.html. Every value is shown as text, as Parquet tools print it. Numbers, text, true/false, dates and times work. A file with list, struct or binary columns is not shown as a table, and neither is one over 5 million rows or 500 columns, or over 200 MB once unpacked. It can still be downloaded.

A Parquet file has no lines, so a comment records the row’s key and its row number instead.

Arrow, NDJSON and Excel

  • .arrow and .feather (the Arrow file format) are shown like Parquet files.
  • .ndjson and .jsonl need one JSON object per line. The keys become the columns, in the order they first appear. Nested values are shown as JSON. A comment records the line.
  • .xlsx workbooks show their first sheet, from its first filled cell. A comment records the sheet’s row number.
  • These start with lower limits: 1 million rows, 500 columns and 100 MB of values.

Run margent check . before pushing to see which files will be tables and which only downloads. margent push warns about the same files.

Keep comments on the right row

A comment on a row is tied to the row’s key. If the first column has a unique value in every row (an id, a name, a date), that value is the key. Then the comment stays with its row when rows are added, removed or reordered in a later version. Otherwise the key is the row number, and a comment can move to a different record when rows shift. So put a stable id in the first column.

Example: a generated table

Tables in the repository need no build step. A table produced by a script can be generated in the workflow and uploaded with the rest:

    steps:
      - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803  # v6.1.0
      - uses: astral-sh/setup-uv@18d369b23da25a81e9458561248e1aafff6a70fa  # v10.3.1
      - name: Export the table
        run: uv run scripts/export.py --out reports/budget.csv
      - uses: sacovo/margent-publish/action@3e05fdf9c312df0e0401680322591080d6b376f3  # pin by SHA
        with:
          dir: .

The generated file must not be git-ignored, or it is left out of the upload. To avoid that, generate it into a folder that is ignored as a whole, and upload that folder.