# readCsv

Function

Source: https://github.com/playcanvas/splat-transform/blob/386b3d6fd878dbab2688e7c7d7164dcbd6e80e34/src/lib/readers/read-csv.ts#L117

```ts
readCsv(source: ReadSource): Promise<DataTable>
```

Reads the numeric CSV dialect produced by `writeCsv` into a data table.

The first row contains unquoted column names and each subsequent row contains
one numeric value per column. Values are in PLY coordinate space (the space
`writeCsv` writes), so the returned table carries `Transform.PLY`. Values are
stored as 32-bit floats because the CSV format does not carry column type
information, so integer values above 2^24 and 64-bit float values lose
precision. `NaN` and positive or negative infinity are accepted.

CSV has no row index to serve random row gathers, so the file is decoded
eagerly into resident columns (4 bytes per value). The text is parsed in a
single streaming pass and is never held in memory whole.

**Parameters**

- `source` ([`ReadSource`](https://api.playcanvas.com/splat-transform/interfaces/ReadSource.md)): Source containing UTF-8 encoded CSV data. The caller owns and closes it.

**Returns** `Promise<`[`DataTable`](https://api.playcanvas.com/splat-transform/classes/DataTable.md)`>`: A data table containing the CSV columns and rows.

**throws** If the CSV is not valid UTF-8, has an invalid header (including a
partial group of standard splat columns, such as `rot_0`-`rot_2` without
`rot_3`), contains rows with the wrong number of values, or contains an
invalid numeric value.
