{"id":17166407,"url":"https://github.com/andreaferretti/csvtools","last_synced_at":"2025-11-08T19:03:44.844Z","repository":{"id":36344324,"uuid":"40649056","full_name":"andreaferretti/csvtools","owner":"andreaferretti","description":"Manage CSV files in Nim","archived":false,"fork":false,"pushed_at":"2021-01-21T09:23:22.000Z","size":84,"stargazers_count":48,"open_issues_count":0,"forks_count":1,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-03-24T17:53:11.875Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://andreaferretti.github.io/csvtools/","language":"Nim","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreaferretti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-13T08:59:49.000Z","updated_at":"2025-02-20T01:18:21.000Z","dependencies_parsed_at":"2022-09-06T00:00:56.538Z","dependency_job_id":null,"html_url":"https://github.com/andreaferretti/csvtools","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaferretti%2Fcsvtools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaferretti%2Fcsvtools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaferretti%2Fcsvtools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaferretti%2Fcsvtools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreaferretti","download_url":"https://codeload.github.com/andreaferretti/csvtools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248288361,"owners_count":21078903,"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":[],"created_at":"2024-10-14T23:05:29.790Z","updated_at":"2025-11-08T19:03:39.818Z","avatar_url":"https://github.com/andreaferretti.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"CSVtools\n========\n\n[![nimble](https://raw.githubusercontent.com/yglukhov/nimble-tag/master/nimble.png)](https://github.com/yglukhov/nimble-tag)\n\nManage CSV files easily in Nim.\n\nThe aim is to be able to transform CSV files into typed iterators, infering\nlayout of things like dates and number where possible, with minimal user intervention.\n\nIn this preliminary version, english locale is assumed for numbers and layout\nof dates must be specified. Still, the automatic typed deserialization is\nalready quite handy.\n\nA symmetric API exists for writing typed sequences into CSV files.\n\nThe conversion from an object of type `T` into a sequence of strings - or\nviceversa the transformation from a sequence of strings into a `T` - is handled\nby a macro. This macro assumes that `T` is a flat type, meaning that its\nmembers are either numbers, dates (`TimeInfo`) or strings.\n\nThe library is updated on Nim devel. For Nim up to 0.13, use version 0.1.0\nof csvtools.\n\n[Api documentation](http://andreaferretti.github.io/csvtools/)\n\nExamples\n--------\n\nSimple iterator over rows as `seq[string]`\n\n```nim\nimport csvtools\n\nfor row in csvRows(\"myfile.csv\"):\n  echo row[4]\n```\n\nTyped iterator supporting numbers, strings and dates\n\n```nim\nimport csvtools, times\n\ntype Payment = object\n  time: TimeInfo\n  accountFrom, accountTo: string\n  amount: float\n\nfor payment in csv[Payment](\"payments.csv\", dateLayout = \"yyyy-MM-dd HH:mm:ss\", skipHeader = true):\n  echo payment.amount\n  echo payment.time.weekday\n```\n\nWriting back into a file\n\n```nim\nimport csvtools\n\ntype Payment = object\n  accountFrom, accountTo: string\n  amount: float\n\nlet payments: seq[Payment] = # ...\n\npayments.writeToCsv(\"payments.csv\")\n```\n\nWriting back, one line at a time\n\n```nim\nimport csvtools\n\ntype Payment = object\n  accountFrom, accountTo: string\n  amount: float\n\nlet payments: seq[Payment] = # ...\n\nvar f = open(\"payments.csv\", fmWrite)\n# lines is an iterator of strings\nfor line in lines(payments):\n  f.write(line)\nf.close()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreaferretti%2Fcsvtools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreaferretti%2Fcsvtools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreaferretti%2Fcsvtools/lists"}