{"id":27130839,"url":"https://github.com/sov3rain/unity-csv","last_synced_at":"2025-04-07T20:18:36.168Z","repository":{"id":268952545,"uuid":"868068748","full_name":"Sov3rain/unity-csv","owner":"Sov3rain","description":"Lightweight and efficient CSV parser without dependencies for Unity.","archived":false,"fork":false,"pushed_at":"2025-04-07T08:17:23.000Z","size":79,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T09:26:59.406Z","etag":null,"topics":["c-sharp","csharp","csv","csv-parser","csv-reader","package","rfc-4180","unity","unity3d","upm","upm-package"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sov3rain.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-05T11:53:14.000Z","updated_at":"2025-04-07T08:17:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"e77d15d0-434c-440a-ab07-09624004be9b","html_url":"https://github.com/Sov3rain/unity-csv","commit_stats":null,"previous_names":["sov3rain/uni-csv","sov3rain/unity-csv"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sov3rain%2Funity-csv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sov3rain%2Funity-csv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sov3rain%2Funity-csv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sov3rain%2Funity-csv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sov3rain","download_url":"https://codeload.github.com/Sov3rain/unity-csv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247721897,"owners_count":20985084,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-sharp","csharp","csv","csv-parser","csv-reader","package","rfc-4180","unity","unity3d","upm","upm-package"],"created_at":"2025-04-07T20:18:35.474Z","updated_at":"2025-04-07T20:18:36.163Z","avatar_url":"https://github.com/Sov3rain.png","language":"C#","readme":"# Unity CSV\n\n## Overview\n\n**unity-csv** is a lightweight and efficient CSV parsing utility designed specifically for Unity projects. It allows easy and flexible parsing of CSV data from both files and strings, supporting multiple delimiter types (comma, tab, semicolon, pipe) and handling common edge cases like quoted fields and multiline data.\n\n## Supported Unity versions\n\nThis package runs on Unity **2019.2 or later**.\n\n## Installation\n\nThis package can be installed with the built-in Unity Package Manager. Open the UPM window, click on the `+` icon, choose **Add package from git URL...** and paste this URL:\n\n```\nhttps://github.com/Sov3rain/unity-csv.git?path=/Assets/uni-csv#1.2.0\n```\n\nThis will install a specific version (here 1.2.0).\n\n## Usage\n\n### Basic\n\nReturns CSV data as `List\u003cList\u003cstring\u003e\u003e`.\n\nYou can parse a string using:\n\n```c#\nCsvParser.ParseFromString(\n    string data, \n    bool hasHeader,\n    bool removeHeader = true,\n    Delimiter delimiter = Delimiter.Auto)\n```\n\nor a file using:\n\n```c#\nCsvParser.ParseFromPath(\n    string path,\n    bool hasHeader,\n    bool removeHeader = true,\n    Delimiter delimiter = Delimiter.Auto,\n    Encoding encoding = null)\n```\n\nBoth methods have the `header` parameter set to `true` by default. If your CSV file does not contains a header row, set this parameter to `false`.\n\n### Advanced\n\nYou can map your CSV to a concrete type using generic methods, which will return an `IEnumerator\u003cT\u003e`. Keep in mind that for the mapping to work properly, the input string or file **must include a header row** when using these generic methods.\n\n```c#\nCsvParser.ParseFromString\u003cT\u003e(\n    string data,\n    bool hasHeader,\n    Delimiter delimiter = Delimiter.Auto)\n```\n\n```c#\nCsvParser.ParseFromPath\u003cT\u003e(\n    string path,\n    bool hasHeader,\n    Delimiter delimiter = Delimiter.Auto,\n    Encoding = null)\n```\n\n\u003e Mapping the CSV to a collection of concrete types is performed using reflection, which can affect performance, even though it is only used once on the header row.\n\n### Examples\n\nGetting back a `List\u003cLIst\u003cstring\u003e\u003e`:\n\n```c#\nvar sheet = CsvParser.ParseFromString(csvString, hasHeader: true);\n\nforeach (var row in sheet)\n{\n    Debug.Log(string.Join(\", \", row));\n}\n```\n\nGetting back a mapped collection of objects:\n\n```c#\nclass User \n{\n    public string Username { get; set; }\n    public string Email { get; set; }\n}\n\nvar users = CsvParser.ParseFromString\u003cUser\u003e(csvString, hasHeader: true);\n\nforeach (User user in users)\n{\n    Debug.Log(user.Username);    \n}\n```\n\nIf the names in the header row don’t match your property names or contain reserved or invalid characters, you can manually map the property to the correct header using the `[CsvColumn(name)]` and `[CsvColumnIndex(index)]` attributes:\n\n```c#\nclass User\n{\n    [CsvColumn(\"User name\")]\n    public string Username { get; set; }\n\n    [CsvColumnIndex(1)]\n    public string Email { get; set; }\n}\n\nvar users = CsvParser.ParseFromString\u003cUser\u003e(csvString, hasHeader: true);\n```\n\nBoth attributes can be mixed in a class, but **name-based mapping will be prioritized**.\n\n## Specs\n\nCompliant with [RFC 4180](http://www.ietf.org/rfc/rfc4180.txt).\n\n- Delimiter auto detection (`,`, `;`, `\\t` and `|` supported).\n- Correctly parse new lines, commas and quotation marks inside cell.\n- Escape double quotes.\n- Support for some encoding types (default is UTF-8).\n- Correctly escapes empty lines and empty content lines.\n\n## Roadmap\n\n- Streaming loading\n- CSV Writing\n\n## Tests\n\nThis package has a set of tests that can be run with the [Unity Test Framework](https://docs.unity3d.com/Packages/com.unity.test-framework@1.4/manual/index.html).\n\n## Acknowledgment\n\nThis package is freely inspired by [GitHub - yutokun/CSV-Parser: CSV Parser for C# without any dependency (on recent platforms).](https://github.com/yutokun/CSV-Parser)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsov3rain%2Funity-csv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsov3rain%2Funity-csv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsov3rain%2Funity-csv/lists"}