Info
This site is generated using the static site generator developed by the Typst Community. Please adjust the text content of this banner according to your usage requirements. At Typst GmbH's request, when publishing documentation, you must clearly indicate that it is non-official and display the version of Typst being documented. For details, refer to Issue #874 on typst/typst.
TypstDocumentEnglish
v0.dev.2025-09-12

csv

Reads structured data from a CSV file.

The CSV file will be read and parsed into a 2-dimensional array of strings: Each row in the CSV file will be represented as an array of strings, and all rows will be collected into a single array. Header rows will not be stripped.

Example

#let results = csv("example.csv")

#table(
  columns: 2,
  [*Condition*], [*Result*],
  ..results.flatten(),
)
Preview

Parameter
Parameter
Parameters are input values for functions. Specify them in parentheses after the function name.

source
Required
Required
Required parameters must be specified when calling the function.
Positional
Positional
Positional parameters can be set by specifying them in order, omitting the parameter name.

A path to a CSV file or raw CSV bytes.

delimiter

The delimiter that separates columns in the CSV file. Must be a single ASCII character.

Default value:

","

row-type

How to represent the file's rows.

  • If set to array, each row is represented as a plain array of strings.
  • If set to dictionary, each row is represented as a dictionary mapping from header keys to strings. This option only makes sense when a header row is present in the CSV file.

Default value:

array

Definition
Definition
These functions and types can have related definitions. To access a definition, specify the name of the function or type, followed by the definition name separated by a period.

decode

Reads structured data from a CSV string/bytes.

data
Required
Required
Required parameters must be specified when calling the function.
Positional
Positional
Positional parameters can be set by specifying them in order, omitting the parameter name.

CSV data.

delimiter

The delimiter that separates columns in the CSV file. Must be a single ASCII character.

Default value:

","

row-type

How to represent the file's rows.

  • If set to array, each row is represented as a plain array of strings.
  • If set to dictionary, each row is represented as a dictionary mapping from header keys to strings. This option only makes sense when a header row is present in the CSV file.

Default value:

array

Open official docs

Search