{"id":15637074,"url":"https://github.com/rusty1s/table2excel","last_synced_at":"2025-04-07T06:12:03.257Z","repository":{"id":57192371,"uuid":"63240274","full_name":"rusty1s/table2excel","owner":"rusty1s","description":"Convert and download html tables to a xlsx-file that can be opened in Microsoft Excel","archived":false,"fork":false,"pushed_at":"2016-12-13T13:09:22.000Z","size":636,"stargazers_count":113,"open_issues_count":13,"forks_count":113,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-15T05:32:01.615Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://rusty1s.github.io/table2excel/demo","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/rusty1s.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":"2016-07-13T11:25:07.000Z","updated_at":"2024-09-10T03:20:05.000Z","dependencies_parsed_at":"2022-09-01T06:00:45.419Z","dependency_job_id":null,"html_url":"https://github.com/rusty1s/table2excel","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusty1s%2Ftable2excel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusty1s%2Ftable2excel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusty1s%2Ftable2excel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusty1s%2Ftable2excel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rusty1s","download_url":"https://codeload.github.com/rusty1s/table2excel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247237678,"owners_count":20906329,"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-03T11:09:50.864Z","updated_at":"2025-04-07T06:12:03.239Z","avatar_url":"https://github.com/rusty1s.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# table2excel\n\n`table2excel` is a ecma5 compiled vanilla javascript plugin to convert and download\nhtml tables to a xlsx-file that can be opened in Microsoft Excel.\n\nIt uses the awesome [js-xlsx](https://github.com/SheetJS/js-xlsx) plugin from\n[Sheet JS](https://github.com/SheetJS) as a dependency. Thanks!\n\n[Demo](https://rusty1s.github.io/table2excel/demo/)\n\n## Quick Start\n\n```html\n\u003cscript src=\"table2excel.js\"\u003e\u003c/script\u003e\n\n\u003cscript\u003e\n  var table2excel = new Table2Excel();\n  table2excel.export(document.querySelectorAll(\"table\"));\n\u003c/script\u003e\n```\n\n## Node\n\n```js\n// npm install table2excel --save\nimport 'table2excel';\nconst Table2Excel = window.Table2Excel;\n\nconst table2excel = new Table2Excel(options);\n```\n\nSee my `webpack` configuration to see how to get `js-xlsx` running with `webpack` in the browser.\n\n## Additional options\n\nYou can pass in options as a parameter like `new Table2Excel(options)`.\nThe currently supported options are:\n\n* `defaultFileName`: The general file name of a downloaded document. Default: `'file'`.\nCan also be adjusted individually for `export` as a second parameter, e.g. `table2excel.export(table, \"cool table\");`.\n* `tableNameDataAttribute`: Data attribute name to identify the worksheet name of a table. Default: `'excel-name'`.\nUsage: `\u003ctable data-excel-name=\"Check this out\"\u003e...\u003c/table\u003e`. If not set, worksheets are numbered incrementally\nfrom 1.\n\n## Cell type handlers\n\n`table2excel` detects a few special cells by default to display them correctly in Excel:\n\n* **Numbers**\n* **Inputs**: for `input[type=\"text\"]`, `select` or `textarea` elements\n* **Dates**: tries to parse the date or set the exact timestamp via `data-timestamp` on the cell (recommended!)\n* **Booleans**: parses `'true'`, `'false'` or checkboxes/radios without text to booleans\n* **Lists**: parses `\u003cul\u003e...\u003c/ul\u003e` or `\u003col\u003e...\u003c/ol\u003e` list elements to `'..., ...'`\n\nEverything else will just get displayed as simple text. You can easily though add custom type handlers for your own needs:\n\n```js\nTable2Excel.extend((cell, cellText) =\u003e {\n  // {HTMLTableCellElement} cell - The current cell.\n  // {string} cellText - The inner text of the current cell.\n\n  // cell should be described by this type handler\n  if (selector) return {\n    t: ...,\n    v: ...,\n  };\n\n  // skip and run next handler\n  return null;\n});\n```\n\nThe return value must be a [js-xlsx cell object](https://github.com/SheetJS/js-xlsx#cell-object).\n\n## Contributing\n\nIf you would like to [submit a pull request](https://github.com/rusty1s/table2excel/pulls)\nwith any changes you make, please feel free!\nSimply run `npm test` to test and `npm start` to compile before submitting pull requests.\n\n## Issues\n\nPlease use the [GitHub issue tracker](https://github.com/rusty1s/table2excel/issues)\nto raise any problems or feature requests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusty1s%2Ftable2excel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frusty1s%2Ftable2excel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusty1s%2Ftable2excel/lists"}