{"id":19541781,"url":"https://github.com/nullscreen/uncsv","last_synced_at":"2026-02-28T12:02:27.376Z","repository":{"id":56897177,"uuid":"160886352","full_name":"nullscreen/uncsv","owner":"nullscreen","description":"A parser for unruly CSVs","archived":false,"fork":false,"pushed_at":"2022-09-10T03:15:27.000Z","size":68,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-12-06T02:00:05.261Z","etag":null,"topics":["csv","parser","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/nullscreen.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}},"created_at":"2018-12-07T23:41:06.000Z","updated_at":"2022-09-07T03:51:34.000Z","dependencies_parsed_at":"2022-08-21T01:50:52.917Z","dependency_job_id":null,"html_url":"https://github.com/nullscreen/uncsv","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/nullscreen/uncsv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullscreen%2Funcsv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullscreen%2Funcsv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullscreen%2Funcsv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullscreen%2Funcsv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nullscreen","download_url":"https://codeload.github.com/nullscreen/uncsv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullscreen%2Funcsv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29933021,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T09:58:13.507Z","status":"ssl_error","status_checked_at":"2026-02-28T09:57:57.047Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["csv","parser","ruby"],"created_at":"2024-11-11T03:11:56.157Z","updated_at":"2026-02-28T12:02:27.311Z","avatar_url":"https://github.com/nullscreen.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Uncsv\n\n[![Gem Version](https://badge.fury.io/rb/uncsv.svg)](https://badge.fury.io/rb/uncsv)\n[![CI](https://github.com/nullscreen/uncsv/workflows/CI/badge.svg)](https://github.com/nullscreen/uncsv/actions?query=workflow%3ACI+branch%main)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/5c70b27a9f874f34b522c3b6589b1266)](https://www.codacy.com/gh/nullscreen/uncsv/dashboard)\n[![Code Coverage](https://codecov.io/gh/nullscreen/uncsv/branch/main/graph/badge.svg?token=PVK51XUVJB)](https://codecov.io/gh/nullscreen/uncsv)\n\nA parser for unruly CSVs\n\nParse CSVs with heirarchical headers and duplicated headers. Skip lines by line\nnumber, etc.\n\n## Documentation\n\nRead below to get started, or see the [API Documentation][api-docs] for more\ndetails.\n\n[api-docs]: https://www.rubydoc.info/github/nullscreen/uncsv\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'uncsv'\n```\n\nAnd then execute:\n\n```sh\nbundle\n```\n\nOr install it yourself as:\n\n```sh\ngem install uncsv\n```\n\n## Usage\n\nReading a CSV with Uncsv is similar to using Ruby's built-in CSV class. Create\na new instance of `Uncsv` and pass it a `String` or `IO`. The second argument\nis an options hash, see below.\n\n```ruby\nrequire 'uncsv'\n\ndata = \"A,B,C\\n1,2,3\"\ncsv = Uncsv.new(data, header_rows: 0)\ncsv.map do { |row| row['B'] }\n```\n\n### Opening a File\n\nUncsv can read directly from the filesystem with the `open` method.\n\n```ruby\nUncsv.open('my_data.csv')\n```\n\n### Enumerable Methods\n\nUncsv is an `Enumerable`. All enumerable methods like `each`, `map`, `reduce`,\netc. are supported.\n\n```ruby\ndata = \"A,B,C\\n1,2,3\\n4,5,6\"\ncsv = Uncsv.new(data, header_rows: 0)\nc_total = csv.reduce do { |sum, row| sum + row['C'] }\n```\n\n### Options\n\nThe following options can be passed as a hash to the second argument of the\nUncsv constructor, or set inside the constructor block.\n\n```ruby\nUncsv.new(data, skip_blanks: true)\n\n# Is equivalent to\nUncsv.new(data) do |config|\n  config.skip_blanks = true\nend\n```\n\n#### Uncsv Options\n\n- `:expand_headers`: Default `false`. If set to `true`, blank header row cells\n  will assume the header of the row to their left. This is useful for\n  heirarchical headers where not all the header cells are filled in. If set to\n  an array of header indexes, only the specified headers will be expanded.\n- `:header_rows`: Default `[]`. Can be set to either a single row index or an\n  array of row indexes. For example, it could be set to `0` to indicate a\n  header in the first row. If set to an array of indexes (`[1,2]`), the header\n  row text will be joined by the `:header_separator`. For example, if if the\n  cell (0,0) had the value `\"Personal\"` and cell (1,0) had the value \"Name\",\n  the header would become `\"Personal.Name\"`. Any data above the last header row\n  will be ignored.\n- `:header_separator`: Default `\".\"`. When using multiple header rows, this is\n  a string used to separate the individual header fields.\n- `:nil_empty`: Default `true`. If `true`, empty cells will be set to `nil`,\n  otherwise, they are set to an empty string.\n- `:normalize_headers`: Default `false`. If set to `true`, header field text\n  will be normalized. The text will be lowercased, and non-alphanumeric\n  characters will be replaced with underscores (`_`). If set to a string,\n  those characters will be replaced with the string instead. If set to a hash,\n  the hash will be treated as options to KeyNormalizer, accepting the\n  `:separator`, and `:downcase` options. If set to another object, it is\n  expected to respond to the `normalize(key)` method by returning a normalized\n  string.\n- `:skip_blanks`: Default `false`. If `true`, rows whose fields are all empty\n  will be skipped.\n- `:skip_rows`: Default `[]`. If set to an array of row indexes, those rows\n  will be skipped. This option does not apply to header rows.\n- `:unique_headers`: Default `false`. If set to `true`, headers will be forced\n  to be unique by appending numbers to duplicates. For example, if two header\n  cells have the text `\"Name\"`, the headers will become `\"Name.0\"`, and\n  `\"Name.1\"`. The separator between the text and the number can be set using\n  the `:header_separator` option.\n\n#### Options from Std-lib CSV\n\nSee the documentation for Ruby's built-in `CSV` class for the following\noptions.\n\n- `:col_sep`\n- `:field_size_limit`\n- `:quote_char`\n- `:row_sep`\n- `:skip_blanks`\n\n## Development\n\nAfter checking out the repo, run `bundle` to install dependencies. You\ncan also run `bin/console` for an interactive prompt that will allow you to\nexperiment.\n\nTo check your work, run `bin/rspec` run the tests and `bin/rubocop` to check\nstyle. To generate a code coverage report, set the `COVERAGE` environment\nvariable when running the tests.\n\n```sh\nCOVERAGE=1 bin/rspec\nbin/rubocop\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at\nhttps://github.com/nullscreen/uncsv.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullscreen%2Funcsv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnullscreen%2Funcsv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullscreen%2Funcsv/lists"}