{"id":41671597,"url":"https://github.com/1pone/json-excel-style","last_synced_at":"2026-01-24T17:39:04.834Z","repository":{"id":57284826,"uuid":"444277301","full_name":"1pone/json-excel-style","owner":"1pone","description":"Export json to excel with style!","archived":false,"fork":false,"pushed_at":"2022-02-17T07:54:16.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-04T09:50:00.939Z","etag":null,"topics":["excel","excel-export","json","json-export","json-to-excel","sheetjs","sheetjs-style","style","styled","xlsx-style"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/json-excel-style","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1pone.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":"2022-01-04T03:47:39.000Z","updated_at":"2022-10-25T19:08:26.000Z","dependencies_parsed_at":"2022-08-25T07:31:30.249Z","dependency_job_id":null,"html_url":"https://github.com/1pone/json-excel-style","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/1pone/json-excel-style","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1pone%2Fjson-excel-style","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1pone%2Fjson-excel-style/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1pone%2Fjson-excel-style/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1pone%2Fjson-excel-style/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1pone","download_url":"https://codeload.github.com/1pone/json-excel-style/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1pone%2Fjson-excel-style/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28732792,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T10:24:43.181Z","status":"ssl_error","status_checked_at":"2026-01-24T10:24:36.112Z","response_time":89,"last_error":"SSL_read: 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":["excel","excel-export","json","json-export","json-to-excel","sheetjs","sheetjs-style","style","styled","xlsx-style"],"created_at":"2026-01-24T17:39:04.179Z","updated_at":"2026-01-24T17:39:04.820Z","avatar_url":"https://github.com/1pone.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json-excel-style\n\n## ℹ️ About\n\nThis project was inspired by [json-as-xlsx](https://github.com/LuisEnMarroquin/json-as-xlsx), and aims to make the export of json data to Excel easier, with more \u003cem\u003e\u003cb\u003estyle\u003c/b\u003e\u003c/em\u003e provided.\n\nThe main dependencies is [sheetjs-style](https://github.com/gitbrent/xlsx-js-style) and underlying dependencies for this project is [sheetjs](https://github.com/sheetjs/sheetjs).\n\nAll projects are under the Apache 2.0 License.\n\n## 🔌 Installation\n\nnpm:\n\n```sh\nnpm install json-excel-style --save\n```\n\nyarn:\n\n```html\nyarn add json-excel-style\n```\n\n### 🪛 Main function\n\n* `jsonExcel(data: IJsonSheet[], settings?: ISettings)`  export excel file with multiple sheets\n\n  - \u003cdetails\u003e\n      \u003csummary\u003e\u003cb\u003eExample\u003c/b\u003e (click to show)\u003c/summary\u003e\n    \n    ```js\n    const baseUrl = 'http://www.baseUrl.com'\n    const data = [\n      {\n        sheetName: 'Adults',\n        header: [\n          {\n            label: 'ID',\n            value: 'id',\n            option: {\n              type: 'hyperlink',\n              render: row =\u003e ({\n                Target: `${baseUrl}/${row?.group}/${row?.id}`,\n                Tooltip: `click to visit ${baseUrl}/${row?.group}/${row?.id}`\n              }),\n              style: {\n                fill: { fgColor: { rgb: 'FFFFAA' } },\n                font: {\n                  bold: true,\n                  italic: true\n                }\n              }\n            }\n          },\n          { label: 'User', value: 'user' }, // Top level data\n          { label: 'Age', value: row =\u003e row.age + ' years' }, // Run functions\n          { label: 'Phone', value: row =\u003e (row.more ? row.more.phone || '' : '') } // Deep props\n        ],\n        data: [\n          { id: 1, group: 1, user: 'Andrea', age: 20, more: { phone: '11111111' } },\n          { id: 2, group: 1, user: 'Luis', age: 21, more: { phone: '22222222' } },\n          { id: 3, group: 2, user: 'Tom', age: 18, more: { phone: '33333333' } },\n          { id: 4, group: 2, user: 'Jack', age: 24, more: { phone: '444444444' } }\n        ]\n      },\n      {\n        sheetName: 'Children',\n        header: false,\n        data: [\n          { id: 11, group: 3, user: 'Manuel', age: 16, more: { phone: '55555555' } },\n          { id: 12, group: 4, user: 'Ana', age: 17, more: { phone: '66666666' } }\n        ]\n      }\n    ]\n    \n    const settings = {\n      fileName: 'PersonalInformation',\n      extraLength: 3,\n    }\n    \n    jsonExcel(data, settings)\n    ```\n    \n    \u003c/details\u003e\n\n\n\n* `jsonSheet(data: IData[], header?: IHeader[] | boolean, fileName?: string, settings?: ISettings)`  fast export single sheet excel file \n\n\n  * \u003cdetails\u003e\n      \u003csummary\u003e\u003cb\u003eExample\u003c/b\u003e (click to show)\u003c/summary\u003e\n\n    ```js\n    const baseUrl = 'http://www.baseUrl.com'\n    \n    const data = [\n      { id: 1, group: 1, user: 'Andrea', age: 20, more: { phone: '11111111' } },\n      { id: 2, group: 1, user: 'Luis', age: 21, more: { phone: '22222222' } },\n      { id: 3, group: 2, user: 'Tom', age: 18, more: { phone: '33333333' } },\n      { id: 4, group: 2, user: 'Jack', age: 24, more: { phone: '444444444' } }\n    ]\n    \n    const header = [\n      {\n        label: 'ID',\n        value: 'id',\n        option: {\n          type: 'hyperlink',\n          render: row =\u003e ({\n            Target: `${baseUrl}/${row?.group}/${row?.id}`,\n            Tooltip: `click to visit ${baseUrl}/${row?.group}/${row?.id}`\n          }),\n          style: {\n            fill: { fgColor: { rgb: 'FFFFAA' } },\n            font: {\n              bold: true,\n              italic: true\n            }\n          }\n        }\n      },\n      { label: 'User', value: 'user' }, // Top level data\n      { label: 'Age', value: row =\u003e row.age + ' years' }, // Run functions\n      { label: 'Phone', value: row =\u003e (row.more ? row.more.phone || '' : '') } // Deep props\n    ]\n    \n    jsonSheet(data, header, \"AdultsInformation\")\n    ```\n\n    \u003c/details\u003e\n\n\n\n### 🗒 API\n\n* **IJsonSheet**\n\n| Attributes | Type                     | Required |\n| ---------- | ------------------------ | -------- |\n| sheetName  | `string`                 | `false`  |\n| header     | `IHeader[]`  \\| `boolean` | `false` |\n| data       | `IData[]`                | `true`   |\n\n* **ISettings**\n\n| Attributes   | Describe                                                     | Type             | Required |\n| ------------ | ------------------------------------------------------------ | ---------------- | -------- |\n| extraLength  | A bigger number means that columns will be wider             | `number`         | `false`  |\n| fileName     | The name of the exported file                                | `string`         | `false`  |\n| writeOptions | [Check detail](https://github.com/SheetJS/sheetjs#writing-options) | `WritingOptions` | `false`  |\n\n* **IData**\n\n{ `[key: string]` : ` string | number | boolean | Date | IData | any` }\n\n* **IHeader**\n\n| Attributes | Sub Attributes | Describe | Type                                           | Required |\n| ---------- | -------------- | -------- | ---------------------------------------------- | -------- |\n| label      | -              | Text displayed in the table header | `string`                                       | `true`   |\n| value      | -              | The key of IData | `string` \\| `((record: IData) =\u003e string` | `true`   |\n| option     | type           | Cell type, default  `\"text\"` | `\"text\"` \\| `\"hyperlink\"` | `false`                  |\n|            | render         | Hyperlink configuration, effective when `type`  is `\"hyperlink\"` | `Hyperlink` \\| `` ((record: IData) =\u003e Hyperlink)`` | `false` |\n|            | style          | The style of column | `CellStyle`                                    | `false`  |\n\n* **Hyperlink**\n\n| Attributes | Describe          | Type     | Required |\n| ---------- | ----------------- | -------- | -------- |\n| Target     | Hyperlink address | `string` | `true`   |\n| Tooltip    | Tooltip           | `string` | `false`  |\n\n* **CellStyle**\n\nCell styles are specified by a style object that roughly parallels the OpenXML structure. The style object has five\ntop-level attributes: `fill`, `font`, `numFmt`, `alignment`, and `border`.\n\n| Style Attribute | Sub Attributes | Values                                                       |\n| :-------------- | :------------- | :----------------------------------------------------------- |\n| fill            | patternType    | `\"solid\"` or `\"none\"`                                        |\n|                 | fgColor        | `COLOR_SPEC`                                                 |\n|                 | bgColor        | `COLOR_SPEC`                                                 |\n| font            | name           | `\"Calibri\"` // default                                       |\n|                 | sz             | `\"11\"` // font size in points                                |\n|                 | color          | `COLOR_SPEC`                                                 |\n|                 | bold           | `true` or `false`                                            |\n|                 | underline      | `true` or `false`                                            |\n|                 | italic         | `true` or `false`                                            |\n|                 | strike         | `true` or `false`                                            |\n|                 | outline        | `true` or `false`                                            |\n|                 | shadow         | `true` or `false`                                            |\n|                 | vertAlign      | `true` or `false`                                            |\n| numFmt          |                | `\"0\"` // integer index to built in formats, see StyleBuilder.SSF property |\n|                 |                | `\"0.00%\"` // string matching a built-in format, see StyleBuilder.SSF |\n|                 |                | `\"0.0%\"` // string specifying a custom format                |\n|                 |                | `\"0.00%;\\\\(0.00%\\\\);\\\\-;@\"` // string specifying a custom format, escaping special characters |\n|                 |                | `\"m/dd/yy\"` // string a date format using Excel's format notation |\n| alignment       | vertical       | `\"bottom\"` or `\"center\"` or `\"top\"`                          |\n|                 | horizontal     | `\"left\"` or `\"center\"` or `\"right\"`                          |\n|                 | wrapText       | `true ` or ` false`                                          |\n|                 | readingOrder   | `2` // for right-to-left                                     |\n|                 | textRotation   | Number from `0` to `180` or `255` (default is `0`)           |\n|                 |                | `90` is rotated up 90 degrees                                |\n|                 |                | `45` is rotated up 45 degrees                                |\n|                 |                | `135` is rotated down 45 degrees                             |\n|                 |                | `180` is rotated down 180 degrees                            |\n|                 |                | `255` is special, aligned vertically                         |\n| border          | top            | `{ style: BORDER_STYLE, color: COLOR_SPEC }`                 |\n|                 | bottom         | `{ style: BORDER_STYLE, color: COLOR_SPEC }`                 |\n|                 | left           | `{ style: BORDER_STYLE, color: COLOR_SPEC }`                 |\n|                 | right          | `{ style: BORDER_STYLE, color: COLOR_SPEC }`                 |\n|                 | diagonal       | `{ style: BORDER_STYLE, color: COLOR_SPEC }`                 |\n|                 | diagonalUp     | `true` or `false`                                            |\n|                 | diagonalDown   | `true` or `false`                                            |\n\n**COLOR_SPEC**: Colors for `fill`, `font`, and `border` are specified as objects, either:\n\n-   `{ auto: 1}` specifying automatic values\n-   `{ rgb: \"FFFFAA00\" }` specifying a hex ARGB value\n-   `{ theme: \"1\", tint: \"-0.25\"}` specifying an integer index to a theme color and a tint value (default 0)\n-   `{ indexed: 64}` default value for `fill.bgColor`\n\n**BORDER_STYLE**: Border style is a string value which may take on one of the following values:\n\n-   `thin`\n-   `medium`\n-   `thick`\n-   `dotted`\n-   `hair`\n-   `dashed`\n-   `mediumDashed`\n-   `dashDot`\n-   `mediumDashDot`\n-   `dashDotDot`\n-   `mediumDashDotDot`\n-   `slantDashDot`\n\nBorders for merged areas are specified for each cell within the merged area. So to apply a box border to a merged area of 3x3 cells, border styles would need to be specified for eight different cells:\n\n-   left borders for the three cells on the left,\n-   right borders for the cells on the right\n-   top borders for the cells on the top\n-   bottom borders for the cells on the left\n\n## 🙏 Thanks\n\n-   [sheetjs](https://github.com/SheetJS/sheetjs)\n-   [json-as-xlsx](https://github.com/LuisEnMarroquin/json-as-xlsx)\n-   [sheetjs-style](https://github.com/gitbrent/xlsx-js-style)\n\n## 🔖 License\n\nPlease consult the attached LICENSE file for details. All rights not explicitly\ngranted by the Apache 2.0 License are reserved by the Original Author.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1pone%2Fjson-excel-style","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1pone%2Fjson-excel-style","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1pone%2Fjson-excel-style/lists"}