{"id":17271824,"url":"https://github.com/jawj/xlsxtable","last_synced_at":"2025-04-09T23:34:48.653Z","repository":{"id":227834458,"uuid":"771760555","full_name":"jawj/xlsxtable","owner":"jawj","description":"A small, simple library to create nice .xlsx Excel files from tabular data","archived":false,"fork":false,"pushed_at":"2024-05-21T08:58:31.000Z","size":548,"stargazers_count":49,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-22T13:03:38.937Z","etag":null,"topics":["excel","typescript","xls","xlsx"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/jawj.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-03-13T22:39:59.000Z","updated_at":"2025-01-14T12:57:12.000Z","dependencies_parsed_at":"2024-03-15T11:51:17.421Z","dependency_job_id":"8dd714bf-4987-46a7-9823-7f193b2e2abf","html_url":"https://github.com/jawj/xlsxtable","commit_stats":null,"previous_names":["jawj/xlsxy","jawj/xlsxtable"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jawj%2Fxlsxtable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jawj%2Fxlsxtable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jawj%2Fxlsxtable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jawj%2Fxlsxtable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jawj","download_url":"https://codeload.github.com/jawj/xlsxtable/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248130365,"owners_count":21052736,"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":["excel","typescript","xls","xlsx"],"created_at":"2024-10-15T08:47:06.666Z","updated_at":"2025-04-09T23:34:48.629Z","avatar_url":"https://github.com/jawj.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# xlsxtable\n\nA small, simple library to create nice `.xlsx` Excel files from tabular data, which:\n\n* Emboldens and (optionally) freezes and autofilters the headings\n* Sets column widths based on cell content\n* Converts dates and times to native Excel format (roughly: floating-point days since 0 Jan 1900)\n* Works everywhere, including Node and browsers\n\nSize: under 7KB gzipped. The only runtime dependency is [littlezipper](https://github.com/jawj/littlezipper) (which is by the same author, tiny, and has no runtime dependencies of its own).\n\nThis library [powers `.xlsx` download in the Neon SQL Editor](https://neon.tech/blog/export-to-csv-json-and-xlsx-from-the-neon-console).\n\n\n## How do you say _xlsxtable_?\n\nPronunciation rhymes with [Hextable](https://en.wikipedia.org/wiki/Hextable), or is similar to vegetable. That is: _ex-el-ess-EX-tuh-bl_.\n\n\n## Types\n\nTypes are defined on a per-column basis. The library supports Excel numbers, strings, dates/times, and empty cells.\n\nExcel has no concept of time zones, so the date and time types have local and UTC variants. The local variants produce a date or time that's the same as the one you get from `date.toString()` (minus the local timezone information, and formatted differently). The UTC variants produce a date or time that's the same as the one shown by `date.toISOString()` (minus the `Z`, and formatted differently).\n\n* For `XlsxTypes.String` columns, cell values will be coerced to `string`.\n* For `XlsxTypes.Number` columns, cell values must be provided as either `number` or (numeric) `string`.\n* For `XlsxTypes.LocalDate`, `XlsxTypes.UTCDate`, `XlsxTypes.LocalTime`, `XlsxTypes.UTCTime`, `XlsxTypes.LocalDateTime` and `XlsxTypes.UTCDateTime` columns, cell values should be provided as `Date` objects, with `string` as a fallback (e.g. if the date is infinite, or before 1900, or otherwise unsupported by Excel).\n* For all column types, `null` or `undefined` cell values result in an empty cell.\n\n\n## Example usage\n\nTo write an `.xlsx` file in Node:\n\n```javascript\nimport { createXlsx, XlsxTypes as Xl } from 'xlsxtable';\nimport { writeFileSync } from 'fs';\n\nconst now = new Date();\n\ncreateXlsx({\n  // sheet data\n  headings: ['id', 'name', 'dob', 'wake_up', 'lastUpdated'],\n  types: [Xl.Number, Xl.String, Xl.LocalDate, Xl.LocalTime, Xl.LocalDateTime],\n  data: [\n    [1, 'Anna', new Date(1979, 0, 1), new Date(0, 0, 0, 7), now],\n    [2, 'Bryn', new Date(1989, 1, 2), new Date(0, 0, 0, 8), now],\n    [3, 'Chip', new Date(1999, 2, 3), new Date(0, 0, 0, 9), now],\n  ],\n  // options\n  sheetName: 'Sheet 1',  // shown on the tab at the bottom: limited character range allowed\n  freeze: true,          // freeze the top/header row\n  autoFilter: true,      // enable autofilter for headers\n  wrapText: true,        // wrap long text cells\n  // metadata\n  creator: 'Diane', \n  title: 'Blughupsnitch data',\n  description: 'Data about the blughupsnitch',\n  company: 'Dogoodnever Inc.',\n})\n  .then(xlsx =\u003e writeFileSync('/path/to/my.xlsx', xlsx));\n```\n\nThis produces [`my.xlsx`](my.xlsx):\n\n![Screenshot](my.xlsx.png)\n\nTo provide a download in browsers, something like this works well:\n\n```javascript\nconst xlsx = await createXlsx(/* ... */);\n\nconst url = URL.createObjectURL(new Blob([xlsx]));\nconst link = document.createElement('a');\nlink.style.display = 'none';\ndocument.body.appendChild(link);\nlink.href = url;\nlink.download = 'my.xlsx';\nlink.click();\nsetTimeout(() =\u003e {\n  URL.revokeObjectURL(url);\n  document.body.removeChild(link);\n}, 0);\n```\n\n## License\n\n[MIT licensed](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjawj%2Fxlsxtable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjawj%2Fxlsxtable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjawj%2Fxlsxtable/lists"}