{"id":21133379,"url":"https://github.com/kris701/csvtoolssharp","last_synced_at":"2025-03-14T12:29:20.409Z","repository":{"id":229028509,"uuid":"775572670","full_name":"kris701/CSVToolsSharp","owner":"kris701","description":"Some simple tools to work with CSV files ","archived":false,"fork":false,"pushed_at":"2024-03-31T08:50:10.000Z","size":78,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T06:26:05.339Z","etag":null,"topics":["csharp","csv"],"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/kris701.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-03-21T16:30:12.000Z","updated_at":"2024-03-21T16:48:36.000Z","dependencies_parsed_at":"2024-03-30T09:26:25.108Z","dependency_job_id":"62efb606-fa65-445e-a6ee-88af6ed16ff4","html_url":"https://github.com/kris701/CSVToolsSharp","commit_stats":null,"previous_names":["kris701/csvtoolssharp"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kris701%2FCSVToolsSharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kris701%2FCSVToolsSharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kris701%2FCSVToolsSharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kris701%2FCSVToolsSharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kris701","download_url":"https://codeload.github.com/kris701/CSVToolsSharp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243576920,"owners_count":20313519,"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":["csharp","csv"],"created_at":"2024-11-20T06:08:12.575Z","updated_at":"2025-03-14T12:29:20.376Z","avatar_url":"https://github.com/kris701.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/kris701/CSVToolsSharp/assets/22596587/9251d9de-632b-41c5-a1da-31750cd24384\" width=\"200\" height=\"200\" /\u003e\n\u003c/p\u003e\n\n[![Build and Publish](https://github.com/kris701/CSVToolsSharp/actions/workflows/dotnet-desktop.yml/badge.svg)](https://github.com/kris701/CSVToolsSharp/actions/workflows/dotnet-desktop.yml)\n![Nuget](https://img.shields.io/nuget/v/CSVToolsSharp)\n![Nuget](https://img.shields.io/nuget/dt/CSVToolsSharp)\n![GitHub last commit (branch)](https://img.shields.io/github/last-commit/kris701/CSVToolsSharp/main)\n![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/m/kris701/CSVToolsSharp)\n![Static Badge](https://img.shields.io/badge/Platform-Windows-blue)\n![Static Badge](https://img.shields.io/badge/Platform-Linux-blue)\n![Static Badge](https://img.shields.io/badge/Framework-dotnet--8.0-green)\n\nCSV Tools Sharp is a little project to manipulate and output CSV files.\nYou can find it on the [NuGet Package Manager](https://www.nuget.org/packages/CSVToolsSharp/) or the [GitHub Package Manager](https://github.com/kris701/CSVToolsSharp/pkgs/nuget/CSVToolsSharp).\n\n# How to Use\nThe package is inspired by that of [System.Text.Json](https://www.nuget.org/packages/System.Text.Json/9.0.0-preview.2.24128.5), where you can access two primary static methods, `CSVSerialiser.Deserialise` and `CSVSerialiser.Serialise` to convert generic classes into CSV format and back.\nYou have to give the properties of the CSV serialisable classes a `CSVColumn` attribute for them to be targeted for serialisation.\nYou can also pass a `CSVSerialiserOptions` object to the serialisation/deserialisation for more settings.\n\nIf you dont want to use this statically typed serialisation and deserialisation, there is also a `DynamicCSV` class.\nThis is intended for times you dont have a class structure or just want a more \"direct\" way of making CSV files.\nIn it you can add and remove columns, rows, cells, etc at will.\n\n## Example\nClass to serialise/deserialize:\n```csharp\npublic class TestClass\n{\n    [CSVColumn(\"Column1\")]\n    public string Value { get; set; }\n}\n```\nYou can then use the serialiser and deserialiser as follows:\n```csharp\nvar csvText = CSVSerialiser.Serialise(new List\u003cTestClass\u003e(){ new TestClass(){ Value = \"abc\" } });\n```\nGives\n```csv\nColumn1\nabc\n```\n\n## Example\nClass to serialise/deserialize:\n```csharp\npublic class TestClass2\n{\n    [CSVColumn(\"Column1\")]\n    public string Value { get; set; }\n    [CSVColumn(\"Column 2\")]\n    public string Value2 { get; set; }\n}\n```\nYou can also make the CSV print more readably:\n```csharp\nvar csvText = CSVSerialiser.Serialise(\n    new List\u003cTestClass2\u003e(){ \n        new TestClass2(){ Value = \"asdafaseasasd\", Value2 = \"abc\" } \n    }, new CSVSerialiserOptions(){ PrettyOutput = true });\n```\nGives\n```csv\nColumn1      ,Column 2\nasdafaseasasd,abc\n```\n\n## Example\nAn example of how to use the `DynamicCSV` object:\n```csharp\nvar item = new DynamicCSV(new Dictionary\u003cstring, List\u003cstring\u003e\u003e());\nitem.AddColumn(\"some-column\");\nitem.Insert(\"some-column\", 0, \"abc\");\nitem.Insert(\"some-column\", 2, \"123\");\nvar csvText = CSVSerialiser.Serialise(item);\n```\nGives the CSV output:\n```csv\nsome-column\nabc\n\n123\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkris701%2Fcsvtoolssharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkris701%2Fcsvtoolssharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkris701%2Fcsvtoolssharp/lists"}