{"id":15713529,"url":"https://github.com/confact/crystal_xlsx","last_synced_at":"2025-03-30T18:46:38.454Z","repository":{"id":236591435,"uuid":"789216012","full_name":"confact/crystal_xlsx","owner":"confact","description":"An Crystal library to write xlsx files with support of styles, custom width and frozen rows.","archived":false,"fork":false,"pushed_at":"2024-07-20T14:32:22.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T07:04:57.132Z","etag":null,"topics":["crystal","excel","excelwriter","xlsx","xlsxwriter"],"latest_commit_sha":null,"homepage":"","language":"Crystal","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/confact.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-20T00:16:19.000Z","updated_at":"2024-07-20T14:32:26.000Z","dependencies_parsed_at":"2024-04-28T00:26:05.393Z","dependency_job_id":"4cca44cb-5a54-4397-aa8c-e57ea0cc7263","html_url":"https://github.com/confact/crystal_xlsx","commit_stats":null,"previous_names":["confact/crystal_xlsx"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/confact%2Fcrystal_xlsx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/confact%2Fcrystal_xlsx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/confact%2Fcrystal_xlsx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/confact%2Fcrystal_xlsx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/confact","download_url":"https://codeload.github.com/confact/crystal_xlsx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246365637,"owners_count":20765546,"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":["crystal","excel","excelwriter","xlsx","xlsxwriter"],"created_at":"2024-10-03T21:31:56.314Z","updated_at":"2025-03-30T18:46:38.226Z","avatar_url":"https://github.com/confact.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# crystal_xlsx\n\nA library to create xlsx (Excel 2006) file with styles, column width and freeze rows.\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     crystal_xlsx:\n       github: confact/crystal_xlsx\n   ```\n\n2. Run `shards install`\n\n## Usage\n\n```crystal\nrequire \"crystal_xlsx\"\n```\n\nAnd then execute:\n\n```crystal\nworkbook = CrystalXlsx::Workbook.new\n\nworksheet = workbook.add_worksheet(\"A worksheet\")\n\nworksheet.add_row([\"Hello\", \"World\"])\n# or\n# worksheet \u003c\u003c [\"Hello\", \"World\"]\n\nworkbook.close(\"./hello_world.xlsx\")\n```\n\nYou can set the column width and freeze rows:\n\n```crystal\nworkbook = CrystalXlsx::Workbook.new\n\nworksheet = workbook.add_worksheet(\"A worksheet\")\n\nworksheet.add_row([\"Hello\", \"World\"])\n\nworksheet.freeze_row(1) # Freeze the first row\n\nworksheet.columns_width = [10, 20] # Set the width of the first column to 10 and the second to 20\n\nworkbook.close(\"./hello_world.xlsx\")\n```\n\nYou can also set the style of the cells:\n\n```crystal\nworkbook = CrystalXlsx::Workbook.new\n\nworksheet = workbook.add_worksheet(\"A worksheet\")\n\nstyle = workbook.add_format(\n  font_name: \"Arial\",\n  font_size: 12,\n  bold: true,\n  text_color: \"FF0000\",\n  bg_color: \"FFFF00\",\n  horizontal_align: \"center\",\n  vertical_align: \"center\"\n)\n\nworksheet.add_row([\"Hello\", \"World\"], style)\n\nworkbook.close(\"./hello_world.xlsx\")\n```\n\nYou can get the result of the workbook as a string:\n\n```crystal\nworkbook = CrystalXlsx::Workbook.new\n\nworksheet = workbook.add_worksheet(\"A worksheet\")\n\nworksheet.add_row([\"Hello\", \"World\"])\n\nputs workbook.to_s\n\n# or send it to a IO\nworkbook.to_io(STDOUT)\n\n```\n\n## Known issues\n- The library does not support formulas\n- The library does not support images\n- The library does not support charts\n\n\n## Benchmark\nAs I made this library due to issues of ruby libraries being slow, I have made a benchmark to compare them. I compare it with the benchmarks at [fast_excel](https://github.com/Paxa/fast_excel) that does a benchmark of 20k write rows and compare it with caxls and write_xlsx.\n\n```\n           FastExcel:        1.4 i/s\n               Axlsx:        0.4 i/s - 3.46x  slower\n          write_xlsx:        0.1 i/s - 17.04x  slower\n```\nAnd crystal_xlsx (Using Crystal's Benchmark module):\n```\n        write 20k rows   3.52  (284.13ms) (± 2.35%)  271MB/op\n```\n\n## Development\n\nFeel free to contribute to the project. You can run the tests with `crystal spec`.\n\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/confact/crystal_xlsx/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Håkan Nylén](https://github.com/confact) - creator and maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconfact%2Fcrystal_xlsx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconfact%2Fcrystal_xlsx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconfact%2Fcrystal_xlsx/lists"}