{"id":22939076,"url":"https://github.com/de-jcup/commons-csv","last_synced_at":"2025-07-13T10:40:18.088Z","repository":{"id":207366571,"uuid":"719070300","full_name":"de-jcup/commons-csv","owner":"de-jcup","description":"A minimal library for CSV data handling","archived":false,"fork":false,"pushed_at":"2023-11-16T07:50:49.000Z","size":117,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-07T12:48:57.421Z","etag":null,"topics":["api","csv","java","lib","small"],"latest_commit_sha":null,"homepage":"","language":"Java","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/de-jcup.png","metadata":{"files":{"readme":"README.adoc","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-15T11:43:10.000Z","updated_at":"2023-11-15T23:29:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"4a6b5b27-d352-4702-87d2-2751e5fc6941","html_url":"https://github.com/de-jcup/commons-csv","commit_stats":null,"previous_names":["de-jcup/commons-csv"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-jcup%2Fcommons-csv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-jcup%2Fcommons-csv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-jcup%2Fcommons-csv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-jcup%2Fcommons-csv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/de-jcup","download_url":"https://codeload.github.com/de-jcup/commons-csv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246704974,"owners_count":20820654,"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":["api","csv","java","lib","small"],"created_at":"2024-12-14T12:36:38.224Z","updated_at":"2025-04-01T19:45:28.821Z","avatar_url":"https://github.com/de-jcup.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":":toc:\n\n== README\n`commons-csv` is a small Java library to handle CSV data. \n\nIt comes without any dependencies to any external libraries - except JRE classes.\n\n\nThe project is licensed by `MIT-License`.\n\n[NOTE]\n====\n`de.jcup.commons` was created based on idea of the Apache commons - with the focus on common \nthings that don't exist there. Unfortunately, I only now saw that there is already a similar \nlibrary from Apache under the exact same name \"commons-csv\" (see https://commons.apache.org/proper/commons-csv/).\n\nThis was not intentional or deliberate. I will continue to use my library, \nbut as I said, there is also a (probably good) alternative from Apache itself.\n====\n\n=== Installation\n==== Gradle\nCreate a `build.gradle` file and add following dependencies:\n[source,groovy]\n----\nplugins {\n    id 'java'\n}\n\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    implementation 'de.jcup.commons:commons-csv:1.0.0'\n}\n\n----\n\n\n=== Usage\n\n==== Example 1\n[source,java,title=\"Create a CSV model and convert to CSV string\"]\n----\nCSVModel model = new CSVModel(\"First name\", \"Last name\", \"Hobbies\");\u003c1\u003e\nmodel.addRow().\u003c2\u003e\n    set(\"Last name\", \"Tregnaghi\").\n    set(\"First name\", \"Albert\").\u003c3\u003e\n    set(\"Hobbies\", \"Software development; Electronic games, Book reading\");\u003c4\u003e\n\nString csv = model.toCSVString();\u003c5\u003e\n\nSystem.out.println(csv);\n\n----\n\u003c1\u003e Creates a CSV model with named columns (\"First name\", \"Last name\", \"Hobbies\").\n    Because no additional model configuration is done, the defaults are set to \n    Unix-Linendings, default separator `;` and cells will be automatically trimmed.\n\u003c2\u003e Creates and adds a new row to model. The created row object has a fluent api.\n\u003c3\u003e We set a value for the \"First name\" column. The ordering does not matter here!\n\u003c4\u003e Sets a column called \"Hobbies\". Here we use the delimiter inside the data which\nlead to auto escaping of the value later\n\nOutput will be:\n\n[source,java]\n----\nFirst name;Last name;Hobbies\nAlbert;Tregnaghi;\"Software development; Electronic games, Book reading\"\u003c1\u003e\n----\n\u003c1\u003e The last column which contains the delimiter char inside, is automatically \n    escaped with character `\"` \n\n==== Example 2\n[source,java,title=\"Parse a CSV string without headlines to model and fetch content by API\"]\n----\nString csv = \"Hello;World\";\n        \nCSVParser parser = new CSVParser();\nCSVModel model = parser.parse(csv,false);\n\n// Because no headlines are defined/fetched, auto column names are created \n// The name pattern is : \"col${columnIndex}\"\nString value1 = model.getCellValue(\"col0\", 0);\nString value2 = model.getCellValue(\"col1\", 0);\nSystem.out.println(value1+\" \"+value2);\n\n----\n\nOutput will be:\n\n[source,java]\n----\nHello World\n----\n\n==== Example 3\n[source,java,title=\"Parse a CSV string with headlines to model and fetch content by API\"]\n----\nString csv = \"Word1;Word2\\nHello;World\\nOther;Line\";\n        \nCSVParser parser = new CSVParser();\nCSVModel model = parser.parse(csv,true);\n\n// We use now the headlines defined inside CSV file:\nString value1 = model.getCellValue(\"Word1\", 0);\nString value2 = model.getCellValue(\"Word2\", 0);\nSystem.out.println(value1+\" \"+value2);\n----\n\nOutput will be:\n\n[source,java]\n----\nHello World\n----\n\n=== Contribution guide\nContributions are welcome.\n\n==== Project location\nhttps://github.com/de-jcup/commons-csv\n\n==== Git setup\n```\ngit clone git@github.com:de-jcup/commons-csv.git\n```\n\nWanted git setup:\n```\ngit config branch.autosetuprebase always\ngit config branch.master.rebase true\ngit config push.default current\ngit config core.autocrlf input\ngit config color.ui auto\ngit config --add remote.origin.fetch +refs/tags/*:refs/tags/*\n```\n\n=== Build\n```\n./gradlew build\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fde-jcup%2Fcommons-csv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fde-jcup%2Fcommons-csv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fde-jcup%2Fcommons-csv/lists"}