CSV

A lightweight extension that provides CVS functionality.

What is CSV?

CSV (Comma-Separated Values) is a simple file format used to store tabular data, such as a spreadsheet or database. Each line of the file is a data record consisting of one or more fields, separated by commas. CSV files are widely used for data exchange between different applications and systems.

Name,Age,City
John,25,New York
Alice,30,"Los Angeles, CA"
Bob,28,Chicago

Features

  • Read CSV from file path

  • Parse CSV from string content or Unity TextAsset

  • Header row handling

  • Proper handling of quoted fields

  • Empty line skipping

  • Regex-based reliable parsing


CSV Data

A data model designed for CSV Serialization.


Reading CSV

Reading from File

Reading from Unity TextAsset

Reading Single Line


Cache CSV Data

Read from file or TextAsset as CsvData.

Use the CsvData


Features Details

  • Quoted Field Support: Properly handles fields containing commas (e.g., "Los Angeles, CA")

  • Empty Line Handling: Automatically skips empty or whitespace-only lines

  • Header Row Option: Easily skip header row when needed

  • Multiple Input Sources: Support for file paths, strings, and Unity TextAssets

  • Memory Efficient: Uses IEnumerable for lazy evaluation

Best Practices

  • Always specify hasHeader explicitly for better code readability

  • Use appropriate method based on your data source (file/string/TextAsset)

  • Handle potential file not found exceptions when using ReadAsCsvFile

  • Consider line endings when working with different platforms

Last updated