{"id":13404132,"url":"https://github.com/exceljs/exceljs","last_synced_at":"2025-12-12T04:03:29.687Z","repository":{"id":24386804,"uuid":"27786663","full_name":"exceljs/exceljs","owner":"exceljs","description":"Excel Workbook Manager","archived":false,"fork":false,"pushed_at":"2025-01-21T16:00:46.000Z","size":21786,"stargazers_count":14353,"open_issues_count":721,"forks_count":1834,"subscribers_count":182,"default_branch":"master","last_synced_at":"2025-05-05T14:14:31.000Z","etag":null,"topics":["csv","exceljs","hacktoberfest","streaming-workbook","workbook","workbook-writer","worksheet","xlsx","xlsx-workbook","xlsxreader","xlsxwriter"],"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/exceljs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2014-12-09T20:57:12.000Z","updated_at":"2025-05-05T11:42:56.000Z","dependencies_parsed_at":"2023-02-12T23:01:47.155Z","dependency_job_id":"f6e6989f-ed46-445d-8efc-f653031ba10d","html_url":"https://github.com/exceljs/exceljs","commit_stats":{"total_commits":1327,"total_committers":228,"mean_commits":"5.8201754385964914","dds":0.6360211002260738,"last_synced_commit":"5bed18b45e824f409b08456b59b87430ded023ab"},"previous_names":["guyonroche/exceljs"],"tags_count":223,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exceljs%2Fexceljs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exceljs%2Fexceljs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exceljs%2Fexceljs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exceljs%2Fexceljs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/exceljs","download_url":"https://codeload.github.com/exceljs/exceljs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253774592,"owners_count":21962199,"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":["csv","exceljs","hacktoberfest","streaming-workbook","workbook","workbook-writer","worksheet","xlsx","xlsx-workbook","xlsxreader","xlsxwriter"],"created_at":"2024-07-30T19:01:39.519Z","updated_at":"2025-12-12T04:03:23.291Z","avatar_url":"https://github.com/exceljs.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Repository","Uncategorized","hacktoberfest","前端开发框架及项目","Programming Languages"],"sub_categories":["Office","Uncategorized","其他_文本生成、文本对话","JavaScript"],"readme":"# ExcelJS\n\n[![Build Status](https://github.com/exceljs/exceljs/actions/workflows/tests.yml/badge.svg?branch=master\u0026event=push)](https://github.com/exceljs/exceljs/actions/workflows/tests.yml)\n\nRead, manipulate and write spreadsheet data and styles to XLSX and JSON.\n\nReverse engineered from Excel spreadsheet files as a project.\n\n# Translations\n\n* [中文文档](README_zh.md)\n\n# Installation\n\n```shell\nnpm install exceljs\n```\n\n# New Features!\n\n* Merged [Add pivot table with limitations #2551](https://github.com/exceljs/exceljs/pull/2551). \u003cbr/\u003e Many thanks to Protobi and \u003ca href=\"https://github.com/mikez\"\u003eMichael\u003c/a\u003e for this contribution!\n* Merged [fix: styles rendering in case when \"numFmt\" is present in conditional formatting rules (resolves #1814) #1815](https://github.com/exceljs/exceljs/pull/1815). \u003cbr/\u003e Many thanks to [@andreykrupskii](https://github.com/andreykrupskii) for this contribution!\n* Merged [inlineStr cell type support #1575 #1576](https://github.com/exceljs/exceljs/pull/1576). \u003cbr/\u003e Many thanks to [@drdmitry](https://github.com/drdmitry) for this contribution!\n* Merged [Fix parsing of boolean attributes #1849](https://github.com/exceljs/exceljs/pull/1849). \u003cbr/\u003e Many thanks to [@bno1](https://github.com/bno1) for this contribution!\n* Merged [add optional custom auto-filter to table #1670](https://github.com/exceljs/exceljs/pull/1670). \u003cbr/\u003e Many thanks to [@thambley](https://github.com/thambley) for this contribution!\n* Merged [Deep copy inherited style #1850](https://github.com/exceljs/exceljs/pull/1850). \u003cbr/\u003e Many thanks to [@ikzhr](https://github.com/ikzhr) for this contribution!\n* Merged [Upgrade actions/cache and actions/setup-node #1846](https://github.com/exceljs/exceljs/pull/1846). \u003cbr/\u003e Many thanks to [@cclauss](https://github.com/cclauss) for this contribution!\n* Merged [Check object keys in isEqual #1831](https://github.com/exceljs/exceljs/pull/1831). \u003cbr/\u003e Many thanks to [@bno1](https://github.com/bno1) for this contribution!\n* Merged [Add v17 to testing workflow #1856](https://github.com/exceljs/exceljs/pull/1856). \u003cbr/\u003e Many thanks to [@Siemienik](https://github.com/Siemienik) for this contribution!\n* Merged [Upgrade jszip to its latest version to date. This version does not have any vulnerability found by Snyk so far #1895](https://github.com/exceljs/exceljs/pull/1895). \u003cbr/\u003e Many thanks to [@ValerioSevilla](https://github.com/ValerioSevilla) for this contribution!\n* Merged [Update README.md #1677](https://github.com/exceljs/exceljs/pull/1677). \u003cbr/\u003e Many thanks to [@xjrcode](https://github.com/xjrcode) for this contribution!\n* Merged [(docs): set prototype of RegExp correctly. #1700](https://github.com/exceljs/exceljs/pull/1700). \u003cbr/\u003e Many thanks to [@joeldenning](https://github.com/joeldenning) for this contribution!\n* Merged [Added timeouts to github actions #1733](https://github.com/exceljs/exceljs/pull/1733). \u003cbr/\u003e Many thanks to [@alexbjorlig](https://github.com/alexbjorlig) for this contribution!\n* Merged [fix issue 1676 #1701](https://github.com/exceljs/exceljs/pull/1701). \u003cbr/\u003e Many thanks to [@skypesky](https://github.com/skypesky) for this contribution!\n* Merged [ExcelJS/ExcelJS#2237 : Update CI Tests, Drop support for Node v8  #2242](https://github.com/exceljs/exceljs/pull/2242). \u003cbr/\u003e Many thanks to [@Siemienik](https://github.com/Siemienik) for this contribution!\n* Merged [Fix types for getWorksheet() #2223](https://github.com/exceljs/exceljs/pull/2223). \u003cbr/\u003e Many thanks to [@hfhchan-plb](https://github.com/hfhchan-plb) for this contribution!\n* Merged [add characters cannot be used for worksheet name #2126](https://github.com/exceljs/exceljs/pull/2126). \u003cbr/\u003e Many thanks to [@tkm-kj](https://github.com/tkm-kj) for this contribution!\n* Merged [Fix issue #1753 Reject promise when workbook reader is writing to temporary file stream and error occurs #1756](https://github.com/exceljs/exceljs/pull/1756). \u003cbr/\u003e Many thanks to [@pauliusg](https://github.com/pauliusg) for this contribution!\n* Merged [README.md to have correct link for Streaming XLSX #2186](https://github.com/exceljs/exceljs/pull/2186). \u003cbr/\u003e Many thanks to [@wulfsolter](https://github.com/wulfsolter) for this contribution!\n* Merged [Added a polyfill of promise.finally to support lower versions of Firefox. #1982](https://github.com/exceljs/exceljs/pull/1982). \u003cbr/\u003e Many thanks to [@DemoJj](https://github.com/DemoJj) for this contribution!\n* Merged [Fix read this.worksheet before assign it #1934](https://github.com/exceljs/exceljs/pull/1934). \u003cbr/\u003e Many thanks to [@ZyqGitHub1](https://github.com/ZyqGitHub1) for this contribution!\n* Merged [chore: upgrade jszip to ^3.10.1 #2211](https://github.com/exceljs/exceljs/pull/2211). \u003cbr/\u003e Many thanks to [@jarrod-cocoon](https://github.com/jarrod-cocoon) for this contribution!\n* Merged [fixed spelling error in README.md file #2208](https://github.com/exceljs/exceljs/pull/2208). \u003cbr/\u003e Many thanks to [@HugoP27](https://github.com/HugoP27) for this contribution!\n* Merged [fix: Fix xlsx.writeFile() not catching error when error occurs #2244](https://github.com/exceljs/exceljs/pull/2244). \u003cbr/\u003e Many thanks to [@zurmokeeper](https://github.com/zurmokeeper) for this contribution!\n* Merged [Improve worksheets' naming validation logic. #2257](https://github.com/exceljs/exceljs/pull/2257). \u003cbr/\u003e Many thanks to [@Siemienik](https://github.com/Siemienik) for this contribution!\n* Merged [fix issue 2125 - spliceRows remove last row #2140](https://github.com/exceljs/exceljs/pull/2140). \u003cbr/\u003e Many thanks to [@babu-ch](https://github.com/babu-ch) for this contribution!\n* Merged [fix: fix the loss of column attributes due to incorrect column order #2222](https://github.com/exceljs/exceljs/pull/2222). \u003cbr/\u003e Many thanks to [@cpaiyueyue](https://github.com/cpaiyueyue) for this contribution!\n* Merged [Fix: Sheet Properties Types #2327](https://github.com/exceljs/exceljs/pull/2327). \u003cbr/\u003e Many thanks to [@albeniraouf](https://github.com/albeniraouf) for this contribution!\n* Merged [Use node 18 LTS for tsc, and benchmark. Add node 20. to test matrix. … #2354](https://github.com/exceljs/exceljs/pull/2354). \u003cbr/\u003e Many thanks to [@Siemienik](https://github.com/Siemienik) for this contribution!\n* Merged [Add missing tooltip attribute to CellHyperlinkValue index.d.ts #2350](https://github.com/exceljs/exceljs/pull/2350). \u003cbr/\u003e Many thanks to [@NiklasPor](https://github.com/NiklasPor) for this contribution!\n* Merged [Increase resilience to generating large workbooks #2320](https://github.com/exceljs/exceljs/pull/2320). \u003cbr/\u003e Many thanks to [@hfhchan-plb](https://github.com/hfhchan-plb) for this contribution!\n* Merged [repair all 'c2fo.io' links ('c2fo.github.io') #2324](https://github.com/exceljs/exceljs/pull/2324). \u003cbr/\u003e Many thanks to [@justintunev7](https://github.com/justintunev7) for this contribution!\n* Merged [fix: fix type definitions about last column, formula values and protection #2309](https://github.com/exceljs/exceljs/pull/2309). \u003cbr/\u003e Many thanks to [@gltjk](https://github.com/gltjk) for this contribution!\n* Merged [fix: add spinCount field for WorksheetProtection type #2284](https://github.com/exceljs/exceljs/pull/2284). \u003cbr/\u003e Many thanks to [@damingerdai](https://github.com/damingerdai) for this contribution!\n* Merged [Add type definition for WorksheetModel.merges #2281](https://github.com/exceljs/exceljs/pull/2281). \u003cbr/\u003e Many thanks to [@ytjmt](https://github.com/ytjmt) for this contribution!\n\n# Contributions\n\nContributions are very welcome! It helps me know what features are desired or what bugs are causing the most pain.\n\nI have just one request; If you submit a pull request for a bugfix, please add a unit-test or integration-test (in the spec folder) that catches the problem.\n Even a PR that just has a failing test is fine - I can analyse what the test is doing and fix the code from that.\n\nNote: Please try to avoid modifying the package version in a PR.\nVersions are updated on release and any change will most likely result in merge collisions.\n\nTo be clear, all contributions added to this library will be included in the library's MIT licence.\n\n### Let's chat together:\n\n[![SiemaTeam](https://discordapp.com/api/guilds/976854442009825321/widget.png?style=banner2)](https://discord.gg/siema)\n\n# Contents\n\n\u003cul\u003e\n  \u003cli\u003e\u003ca href=\"#importing\"\u003eImporting\u003c/a\u003e\u003c/li\u003e\n  \u003cli\u003e\n    \u003ca href=\"#interface\"\u003eInterface\u003c/a\u003e\n    \u003cul\u003e\n      \u003cli\u003e\u003ca href=\"#create-a-workbook\"\u003eCreate a Workbook\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#set-workbook-properties\"\u003eSet Workbook Properties\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#workbook-views\"\u003eWorkbook Views\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#add-a-worksheet\"\u003eAdd a Worksheet\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#remove-a-worksheet\"\u003eRemove a Worksheet\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#access-worksheets\"\u003eAccess Worksheets\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#worksheet-state\"\u003eWorksheet State\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#worksheet-properties\"\u003eWorksheet Properties\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#page-setup\"\u003ePage Setup\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#headers-and-footers\"\u003eHeaders and Footers\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\n        \u003ca href=\"#worksheet-views\"\u003eWorksheet Views\u003c/a\u003e\n        \u003cul\u003e\n          \u003cli\u003e\u003ca href=\"#frozen-views\"\u003eFrozen Views\u003c/a\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ca href=\"#split-views\"\u003eSplit Views\u003c/a\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#auto-filters\"\u003eAuto Filters\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#columns\"\u003eColumns\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#rows\"\u003eRows\u003c/a\u003e\n        \u003cul\u003e\n          \u003cli\u003e\u003ca href=\"#add-rows\"\u003eAdd Rows\u003c/a\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ca href=\"#handling-individual-cells\"\u003eHandling Individual Cells\u003c/a\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ca href=\"#merged-cells\"\u003eMerged Cells\u003c/a\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ca href=\"#insert-rows\"\u003eInsert Rows\u003c/a\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ca href=\"#splice\"\u003eSplice\u003c/a\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ca href=\"#duplicate-a-row\"\u003eDuplicate Row\u003c/a\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#defined-names\"\u003eDefined Names\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#data-validations\"\u003eData Validations\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#cell-comments\"\u003eCell Comments\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#tables\"\u003eTables\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#styles\"\u003eStyles\u003c/a\u003e\n        \u003cul\u003e\n          \u003cli\u003e\u003ca href=\"#number-formats\"\u003eNumber Formats\u003c/a\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ca href=\"#fonts\"\u003eFonts\u003c/a\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ca href=\"#alignment\"\u003eAlignment\u003c/a\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ca href=\"#borders\"\u003eBorders\u003c/a\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ca href=\"#fills\"\u003eFills\u003c/a\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ca href=\"#rich-text\"\u003eRich Text\u003c/a\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#conditional-formatting\"\u003eConditional Formatting\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#outline-levels\"\u003eOutline Levels\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#images\"\u003eImages\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#sheet-protection\"\u003eSheet Protection\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#file-io\"\u003eFile I/O\u003c/a\u003e\n        \u003cul\u003e\n          \u003cli\u003e\u003ca href=\"#xlsx\"\u003eXLSX\u003c/a\u003e\n            \u003cul\u003e\n              \u003cli\u003e\u003ca href=\"#reading-xlsx\"\u003eReading XLSX\u003c/a\u003e\u003c/li\u003e\n              \u003cli\u003e\u003ca href=\"#writing-xlsx\"\u003eWriting XLSX\u003c/a\u003e\u003c/li\u003e\n            \u003c/ul\u003e\n          \u003c/li\u003e\n          \u003cli\u003e\u003ca href=\"#csv\"\u003eCSV\u003c/a\u003e\n            \u003cul\u003e\n              \u003cli\u003e\u003ca href=\"#reading-csv\"\u003eReading CSV\u003c/a\u003e\u003c/li\u003e\n              \u003cli\u003e\u003ca href=\"#writing-csv\"\u003eWriting CSV\u003c/a\u003e\u003c/li\u003e\n            \u003c/ul\u003e\n          \u003c/li\u003e\n          \u003cli\u003e\u003ca href=\"#streaming-io\"\u003eStreaming I/O\u003c/a\u003e\n            \u003cul\u003e\n              \u003cli\u003e\u003ca href=\"#streaming-xlsx\"\u003eStreaming XLSX\u003c/a\u003e\u003c/li\u003e\n            \u003c/ul\u003e\n          \u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"#browser\"\u003eBrowser\u003c/a\u003e\u003c/li\u003e\n  \u003cli\u003e\n    \u003ca href=\"#value-types\"\u003eValue Types\u003c/a\u003e\n    \u003cul\u003e\n      \u003cli\u003e\u003ca href=\"#null-value\"\u003eNull Value\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#merge-cell\"\u003eMerge Cell\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#number-value\"\u003eNumber Value\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#string-value\"\u003eString Value\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#date-value\"\u003eDate Value\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#hyperlink-value\"\u003eHyperlink Value\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\n        \u003ca href=\"#formula-value\"\u003eFormula Value\u003c/a\u003e\n        \u003cul\u003e\n          \u003cli\u003e\u003ca href=\"#shared-formula\"\u003eShared Formula\u003c/a\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ca href=\"#formula-type\"\u003eFormula Type\u003c/a\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ca href=\"#array-formula\"\u003eArray Formula\u003c/a\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#rich-text-value\"\u003eRich Text Value\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#boolean-value\"\u003eBoolean Value\u003c/a\u003e\u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#error-value\"\u003eError Value\u003c/a\u003e\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"#config\"\u003eConfig\u003c/a\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"#known-issues\"\u003eKnown Issues\u003c/a\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"#release-history\"\u003eRelease History\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n# Importing[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\nconst ExcelJS = require('exceljs');\n```\n\n## ES5 Imports[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nTo use the ES5 transpiled code, for example for node.js versions older than 10, use the dist/es5 path.\n\n```javascript\nconst ExcelJS = require('exceljs/dist/es5');\n```\n\n**Note:** The ES5 build has an implicit dependency on a number of polyfills which are no longer\n explicitly added by exceljs.\n You will need to add \"core-js\" and \"regenerator-runtime\" to your dependencies and\n include the following requires in your code before the exceljs import:\n\n```javascript\n// polyfills required by exceljs\nrequire('core-js/modules/es.promise');\nrequire('core-js/modules/es.string.includes');\nrequire('core-js/modules/es.object.assign');\nrequire('core-js/modules/es.object.keys');\nrequire('core-js/modules/es.symbol');\nrequire('core-js/modules/es.symbol.async-iterator');\nrequire('regenerator-runtime/runtime');\n\nconst ExcelJS = require('exceljs/dist/es5');\n```\n\nFor IE 11, you'll also need a polyfill to support unicode regex patterns. For example,\n\n```js\nconst rewritePattern = require('regexpu-core');\nconst {generateRegexpuOptions} = require('@babel/helper-create-regexp-features-plugin/lib/util');\n\nconst {RegExp} = global;\ntry {\n  new RegExp('a', 'u');\n} catch (err) {\n  global.RegExp = function(pattern, flags) {\n    if (flags \u0026\u0026 flags.includes('u')) {\n      return new RegExp(rewritePattern(pattern, flags, generateRegexpuOptions({flags, pattern})));\n    }\n    return new RegExp(pattern, flags);\n  };\n  global.RegExp.prototype = RegExp.prototype;\n}\n```\n\n## Browserify[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nExcelJS publishes two browserified bundles inside the dist/ folder:\n\nOne with implicit dependencies on core-js polyfills...\n```html\n\u003cscript src=\"https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.26.0/polyfill.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"exceljs.js\"\u003e\u003c/script\u003e\n```\n\nAnd one without...\n```html\n\u003cscript src=\"--your-project's-pollyfills-here--\"\u003e\u003c/script\u003e\n\u003cscript src=\"exceljs.bare.js\"\u003e\u003c/script\u003e\n```\n\n\n# Interface[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n## Create a Workbook[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\nconst workbook = new ExcelJS.Workbook();\n```\n\n## Set Workbook Properties[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\nworkbook.creator = 'Me';\nworkbook.lastModifiedBy = 'Her';\nworkbook.created = new Date(1985, 8, 30);\nworkbook.modified = new Date();\nworkbook.lastPrinted = new Date(2016, 9, 27);\n```\n\n```javascript\n// Set workbook dates to 1904 date system\nworkbook.properties.date1904 = true;\n```\n\n## Set Calculation Properties[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\n// Force workbook calculation on load\nworkbook.calcProperties.fullCalcOnLoad = true;\n```\n\n## Workbook Views[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nThe Workbook views controls how many separate windows Excel will open when viewing the workbook.\n\n```javascript\nworkbook.views = [\n  {\n    x: 0, y: 0, width: 10000, height: 20000,\n    firstSheet: 0, activeTab: 1, visibility: 'visible'\n  }\n]\n```\n\n## Add a Worksheet[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\nconst sheet = workbook.addWorksheet('My Sheet');\n```\n\nUse the second parameter of the addWorksheet function to specify options for the worksheet.\n\nFor Example:\n\n```javascript\n// create a sheet with red tab colour\nconst sheet = workbook.addWorksheet('My Sheet', {properties:{tabColor:{argb:'FFC0000'}}});\n\n// create a sheet where the grid lines are hidden\nconst sheet = workbook.addWorksheet('My Sheet', {views: [{showGridLines: false}]});\n\n// create a sheet with the first row and column frozen\nconst sheet = workbook.addWorksheet('My Sheet', {views:[{state: 'frozen', xSplit: 1, ySplit:1}]});\n\n// Create worksheets with headers and footers\nconst sheet = workbook.addWorksheet('My Sheet', {\n  headerFooter:{firstHeader: \"Hello Exceljs\", firstFooter: \"Hello World\"}\n});\n\n// create new sheet with pageSetup settings for A4 - landscape\nconst worksheet =  workbook.addWorksheet('My Sheet', {\n  pageSetup:{paperSize: 9, orientation:'landscape'}\n});\n```\n\n## Remove a Worksheet[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nUse the worksheet `id` to remove the sheet from workbook.\n\nFor Example:\n\n```javascript\n// Create a worksheet\nconst sheet = workbook.addWorksheet('My Sheet');\n\n// Remove the worksheet using worksheet id\nworkbook.removeWorksheet(sheet.id)\n```\n\n## Access Worksheets[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n```javascript\n// Iterate over all sheets\n// Note: workbook.worksheets.forEach will still work but this is better\nworkbook.eachSheet(function(worksheet, sheetId) {\n  // ...\n});\n\n// fetch sheet by name\nconst worksheet = workbook.getWorksheet('My Sheet');\n\n// fetch sheet by id\n// INFO: Be careful when using it!\n// It tries to access to `worksheet.id` field. Sometimes (really very often) workbook has worksheets with id not starting from 1.\n// For instance It happens when any worksheet has been deleted.\n// It's much more safety when you assume that ids are random. And stop to use this function.\n// If you need to access all worksheets in a loop please look to the next example.\nconst worksheet = workbook.getWorksheet(1);\n\n// access by `worksheets` array:\nworkbook.worksheets[0]; //the first one;\n\n```\n\nIt's important to know that `workbook.getWorksheet(1) != Workbook.worksheets[0]` and `workbook.getWorksheet(1) != Workbook.worksheets[1]`,\nbecause `workbook.worksheets[0].id` may have any value.\n\n## Worksheet State[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\n// make worksheet visible\nworksheet.state = 'visible';\n\n// make worksheet hidden\nworksheet.state = 'hidden';\n\n// make worksheet hidden from 'hide/unhide' dialog\nworksheet.state = 'veryHidden';\n```\n\n## Worksheet Properties[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nWorksheets support a property bucket to allow control over some features of the worksheet.\n\n```javascript\n// create new sheet with properties\nconst worksheet = workbook.addWorksheet('sheet', {properties:{tabColor:{argb:'FF00FF00'}}});\n\n// create a new sheet writer with properties\nconst worksheetWriter = workbookWriter.addWorksheet('sheet', {properties:{outlineLevelCol:1}});\n\n// adjust properties afterwards (not supported by worksheet-writer)\nworksheet.properties.outlineLevelCol = 2;\nworksheet.properties.defaultRowHeight = 15;\n```\n\n**Supported Properties**\n\n| Name             | Default    | Description |\n| ---------------- | ---------- | ----------- |\n| tabColor         | undefined  | Color of the tabs |\n| outlineLevelCol  | 0          | The worksheet column outline level |\n| outlineLevelRow  | 0          | The worksheet row outline level |\n| defaultRowHeight | 15         | Default row height |\n| defaultColWidth  | (optional) | Default column width |\n| dyDescent        | 55         | TBD |\n\n### Worksheet Metrics[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nSome new metrics have been added to Worksheet...\n\n| Name              | Description |\n| ----------------- | ----------- |\n| rowCount          | The total row size of the document. Equal to the row number of the last row that has values. |\n| actualRowCount    | A count of the number of rows that have values. If a mid-document row is empty, it will not be included in the count. |\n| columnCount       | The total column size of the document. Equal to the maximum cell count from all of the rows |\n| actualColumnCount | A count of the number of columns that have values. |\n\n\n## Page Setup[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nAll properties that can affect the printing of a sheet are held in a pageSetup object on the sheet.\n\n```javascript\n// create new sheet with pageSetup settings for A4 - landscape\nconst worksheet =  workbook.addWorksheet('sheet', {\n  pageSetup:{paperSize: 9, orientation:'landscape'}\n});\n\n// create a new sheet writer with pageSetup settings for fit-to-page\nconst worksheetWriter = workbookWriter.addWorksheet('sheet', {\n  pageSetup:{fitToPage: true, fitToHeight: 5, fitToWidth: 7}\n});\n\n// adjust pageSetup settings afterwards\nworksheet.pageSetup.margins = {\n  left: 0.7, right: 0.7,\n  top: 0.75, bottom: 0.75,\n  header: 0.3, footer: 0.3\n};\n\n// Set Print Area for a sheet\nworksheet.pageSetup.printArea = 'A1:G20';\n\n// Set multiple Print Areas by separating print areas with '\u0026\u0026'\nworksheet.pageSetup.printArea = 'A1:G10\u0026\u0026A11:G20';\n\n// Repeat specific rows on every printed page\nworksheet.pageSetup.printTitlesRow = '1:3';\n\n// Repeat specific columns on every printed page\nworksheet.pageSetup.printTitlesColumn = 'A:C';\n```\n\n**Supported pageSetup settings**\n\n| Name                  | Default       | Description |\n| --------------------- | ------------- | ----------- |\n| margins               |               | Whitespace on the borders of the page. Units are inches. |\n| orientation           | 'portrait'    | Orientation of the page - i.e. taller (portrait) or wider (landscape) |\n| horizontalDpi         | 4294967295    | Horizontal Dots per Inch. Default value is -1 |\n| verticalDpi           | 4294967295    | Vertical Dots per Inch. Default value is -1 |\n| fitToPage             |               | Whether to use fitToWidth and fitToHeight or scale settings. Default is based on presence of these settings in the pageSetup object - if both are present, scale wins (i.e. default will be false) |\n| pageOrder             | 'downThenOver'| Which order to print the pages - one of ['downThenOver', 'overThenDown'] |\n| blackAndWhite         | false         | Print without colour |\n| draft                 | false         | Print with less quality (and ink) |\n| cellComments          | 'None'        | Where to place comments - one of ['atEnd', 'asDisplayed', 'None'] |\n| errors                | 'displayed'   | Where to show errors - one of ['dash', 'blank', 'NA', 'displayed'] |\n| scale                 | 100           | Percentage value to increase or reduce the size of the print. Active when fitToPage is false |\n| fitToWidth            | 1             | How many pages wide the sheet should print on to. Active when fitToPage is true  |\n| fitToHeight           | 1             | How many pages high the sheet should print on to. Active when fitToPage is true  |\n| paperSize             |               | What paper size to use (see below) |\n| showRowColHeaders     | false         | Whether to show the row numbers and column letters |\n| showGridLines         | false         | Whether to show grid lines |\n| firstPageNumber       |               | Which number to use for the first page |\n| horizontalCentered    | false         | Whether to center the sheet data horizontally |\n| verticalCentered      | false         | Whether to center the sheet data vertically |\n\n**Example Paper Sizes**\n\n| Name                          | Value     |\n| ----------------------------- | --------- |\n| Letter                        | undefined |\n| Legal                         |  5        |\n| Executive                     |  7        |\n| A3                            |  8        |\n| A4                            |  9        |\n| A5                            |  11       |\n| B5 (JIS)                      |  13       |\n| Envelope #10                  |  20       |\n| Envelope DL                   |  27       |\n| Envelope C5                   |  28       |\n| Envelope B5                   |  34       |\n| Envelope Monarch              |  37       |\n| Double Japan Postcard Rotated |  82       |\n| 16K 197x273 mm                |  119      |\n\n## Headers and Footers[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nHere's how to add headers and footers.\nThe added content is mainly text, such as time, introduction, file information, etc., and you can set the style of the text.\nIn addition, you can set different texts for the first page and even page.\n\nNote: Images are not currently supported.\n\n```javascript\n\n// Create worksheets with headers and footers\nvar sheet = workbook.addWorksheet('sheet', {\n  headerFooter:{firstHeader: \"Hello Exceljs\", firstFooter: \"Hello World\"}\n});\n// Create worksheets with headers and footers\nvar worksheetWriter = workbookWriter.addWorksheet('sheet', {\n  headerFooter:{firstHeader: \"Hello Exceljs\", firstFooter: \"Hello World\"}\n});\n// Set footer (default centered), result: \"Page 2 of 16\"\nworksheet.headerFooter.oddFooter = \"Page \u0026P of \u0026N\";\n\n// Set the footer (default centered) to bold, resulting in: \"Page 2 of 16\"\nworksheet.headerFooter.oddFooter = \"Page \u0026P of \u0026N\";\n\n// Set the left footer to 18px and italicize. Result: \"Page 2 of 16\"\nworksheet.headerFooter.oddFooter = \"\u0026LPage \u0026P of \u0026N\";\n\n// Set the middle header to gray Aril, the result: \"52 exceljs\"\nworksheet.headerFooter.oddHeader = \"\u0026C\u0026KCCCCCC\u0026\\\"Aril\\\"52 exceljs\";\n\n// Set the left, center, and right text of the footer. Result: “Exceljs” in the footer left. “demo.xlsx” in the footer center. “Page 2” in the footer right\nworksheet.headerFooter.oddFooter = \"\u0026Lexceljs\u0026C\u0026F\u0026RPage \u0026P\";\n\n// Add different header \u0026 footer for the first page\nworksheet.headerFooter.differentFirst = true;\nworksheet.headerFooter.firstHeader = \"Hello Exceljs\";\nworksheet.headerFooter.firstFooter = \"Hello World\"\n```\n\n**Supported headerFooter settings**\n\n| Name              | Default   | Description |\n| ----------------- | --------- | ----------- |\n| differentFirst    | false     | Set the value of differentFirst as true, which indicates that headers/footers for first page are different from the other pages |\n| differentOddEven  | false     | Set the value of differentOddEven as true, which indicates that headers/footers for odd and even pages are different |\n| oddHeader         | null      | Set header string for odd(default) pages, could format the string |\n| oddFooter         | null      | Set footer string for odd(default) pages, could format the string |\n| evenHeader        | null      | Set header string for even pages, could format the string |\n| evenFooter        | null      | Set footer string for even pages, could format the string |\n| firstHeader       | null      | Set header string for the first page, could format the string |\n| firstFooter       | null      | Set footer string for the first page, could format the string |\n\n**Script Commands**\n\n| Commands     | Description |\n| ------------ | ----------- |\n| \u0026L           | Set position to the left |\n| \u0026C           | Set position to the center |\n| \u0026R           | Set position to the right |\n| \u0026P           | The current page number |\n| \u0026N           | The total number of pages |\n| \u0026D           | The current date |\n| \u0026T           | The current time |\n| \u0026G           | A picture |\n| \u0026A           | The worksheet name |\n| \u0026F           | The file name |\n| \u0026B           | Make text bold |\n| \u0026I           | Italicize text |\n| \u0026U           | Underline text |\n| \u0026\"font name\" | font name, for example \u0026\"Aril\" |\n| \u0026font size   | font size, for example 12 |\n| \u0026KHEXCode    | font color, for example \u0026KCCCCCC |\n\n## Worksheet Views[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nWorksheets now support a list of views, that control how Excel presents the sheet:\n\n* frozen - where a number of rows and columns to the top and left are frozen in place. Only the bottom right section will scroll\n* split - where the view is split into 4 sections, each semi-independently scrollable.\n\nEach view also supports various properties:\n\n| Name              | Default   | Description |\n| ----------------- | --------- | ----------- |\n| state             | 'normal'  | Controls the view state - one of normal, frozen or split |\n| rightToLeft       | false     | Sets the worksheet view's orientation to right-to-left |\n| activeCell        | undefined | The currently selected cell |\n| showRuler         | true      | Shows or hides the ruler in Page Layout |\n| showRowColHeaders | true      | Shows or hides the row and column headers (e.g. A1, B1 at the top and 1,2,3 on the left |\n| showGridLines     | true      | Shows or hides the gridlines (shown for cells where borders have not been defined) |\n| zoomScale         | 100       | Percentage zoom to use for the view |\n| zoomScaleNormal   | 100       | Normal zoom for the view |\n| style             | undefined | Presentation style - one of pageBreakPreview or pageLayout. Note pageLayout is not compatible with frozen views |\n\n### Frozen Views[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nFrozen views support the following extra properties:\n\n| Name              | Default   | Description |\n| ----------------- | --------- | ----------- |\n| xSplit            | 0         | How many columns to freeze. To freeze rows only, set this to 0 or undefined |\n| ySplit            | 0         | How many rows to freeze. To freeze columns only, set this to 0 or undefined |\n| topLeftCell       | special   | Which cell will be top-left in the bottom-right pane. Note: cannot be a frozen cell. Defaults to first unfrozen cell |\n\n```javascript\nworksheet.views = [\n  {state: 'frozen', xSplit: 2, ySplit: 3, topLeftCell: 'G10', activeCell: 'A1'}\n];\n```\n\n### Split Views[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nSplit views support the following extra properties:\n\n| Name              | Default   | Description |\n| ----------------- | --------- | ----------- |\n| xSplit            | 0         | How many points from the left to place the splitter. To split vertically, set this to 0 or undefined |\n| ySplit            | 0         | How many points from the top to place the splitter. To split horizontally, set this to 0 or undefined  |\n| topLeftCell       | undefined | Which cell will be top-left in the bottom-right pane. |\n| activePane        | undefined | Which pane will be active - one of topLeft, topRight, bottomLeft and bottomRight |\n\n```javascript\nworksheet.views = [\n  {state: 'split', xSplit: 2000, ySplit: 3000, topLeftCell: 'G10', activeCell: 'A1'}\n];\n```\n\n## Auto filters[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nIt is possible to apply an auto filter to your worksheet.\n\n```javascript\nworksheet.autoFilter = 'A1:C1';\n```\n\nWhile the range string is the standard form of the autoFilter, the worksheet will also support the\nfollowing values:\n\n```javascript\n// Set an auto filter from A1 to C1\nworksheet.autoFilter = {\n  from: 'A1',\n  to: 'C1',\n}\n\n// Set an auto filter from the cell in row 3 and column 1\n// to the cell in row 5 and column 12\nworksheet.autoFilter = {\n  from: {\n    row: 3,\n    column: 1\n  },\n  to: {\n    row: 5,\n    column: 12\n  }\n}\n\n// Set an auto filter from D3 to the\n// cell in row 7 and column 5\nworksheet.autoFilter = {\n  from: 'D3',\n  to: {\n    row: 7,\n    column: 5\n  }\n}\n```\n\n## Columns[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\n// Add column headers and define column keys and widths\n// Note: these column structures are a workbook-building convenience only,\n// apart from the column width, they will not be fully persisted.\nworksheet.columns = [\n  { header: 'Id', key: 'id', width: 10 },\n  { header: 'Name', key: 'name', width: 32 },\n  { header: 'D.O.B.', key: 'DOB', width: 10, outlineLevel: 1 }\n];\n\n// Access an individual columns by key, letter and 1-based column number\nconst idCol = worksheet.getColumn('id');\nconst nameCol = worksheet.getColumn('B');\nconst dobCol = worksheet.getColumn(3);\n\n// set column properties\n\n// Note: will overwrite cell value C1\ndobCol.header = 'Date of Birth';\n\n// Note: this will overwrite cell values C1:C2\ndobCol.header = ['Date of Birth', 'A.K.A. D.O.B.'];\n\n// from this point on, this column will be indexed by 'dob' and not 'DOB'\ndobCol.key = 'dob';\n\ndobCol.width = 15;\n\n// Hide the column if you'd like\ndobCol.hidden = true;\n\n// set an outline level for columns\nworksheet.getColumn(4).outlineLevel = 0;\nworksheet.getColumn(5).outlineLevel = 1;\n\n// columns support a readonly field to indicate the collapsed state based on outlineLevel\nexpect(worksheet.getColumn(4).collapsed).to.equal(false);\nexpect(worksheet.getColumn(5).collapsed).to.equal(true);\n\n// iterate over all current cells in this column\ndobCol.eachCell(function(cell, rowNumber) {\n  // ...\n});\n\n// iterate over all current cells in this column including empty cells\ndobCol.eachCell({ includeEmpty: true }, function(cell, rowNumber) {\n  // ...\n});\n\n// add a column of new values\nworksheet.getColumn(6).values = [1,2,3,4,5];\n\n// add a sparse column of values\nworksheet.getColumn(7).values = [,,2,3,,5,,7,,,,11];\n\n// cut one or more columns (columns to the right are shifted left)\n// If column properties have been defined, they will be cut or moved accordingly\n// Known Issue: If a splice causes any merged cells to move, the results may be unpredictable\nworksheet.spliceColumns(3,2);\n\n// remove one column and insert two more.\n// Note: columns 4 and above will be shifted right by 1 column.\n// Also: If the worksheet has more rows than values in the column inserts,\n//  the rows will still be shifted as if the values existed\nconst newCol3Values = [1,2,3,4,5];\nconst newCol4Values = ['one', 'two', 'three', 'four', 'five'];\nworksheet.spliceColumns(3, 1, newCol3Values, newCol4Values);\n\n```\n\n## Rows[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\n// Get a row object. If it doesn't already exist, a new empty one will be returned\nconst row = worksheet.getRow(5);\n\n// Get multiple row objects. If it doesn't already exist, new empty ones will be returned\nconst rows = worksheet.getRows(5, 2); // start, length (\u003e0, else undefined is returned)\n\n// Get the last editable row in a worksheet (or undefined if there are none)\nconst row = worksheet.lastRow;\n\n// Set a specific row height\nrow.height = 42.5;\n\n// make row hidden\nrow.hidden = true;\n\n// set an outline level for rows\nworksheet.getRow(4).outlineLevel = 0;\nworksheet.getRow(5).outlineLevel = 1;\n\n// rows support a readonly field to indicate the collapsed state based on outlineLevel\nexpect(worksheet.getRow(4).collapsed).to.equal(false);\nexpect(worksheet.getRow(5).collapsed).to.equal(true);\n\n\nrow.getCell(1).value = 5; // A5's value set to 5\nrow.getCell('name').value = 'Zeb'; // B5's value set to 'Zeb' - assuming column 2 is still keyed by name\nrow.getCell('C').value = new Date(); // C5's value set to now\n\n// Get a row as a sparse array\n// Note: interface change: worksheet.getRow(4) ==\u003e worksheet.getRow(4).values\nrow = worksheet.getRow(4).values;\nexpect(row[5]).toEqual('Kyle');\n\n// assign row values by contiguous array (where array element 0 has a value)\nrow.values = [1,2,3];\nexpect(row.getCell(1).value).toEqual(1);\nexpect(row.getCell(2).value).toEqual(2);\nexpect(row.getCell(3).value).toEqual(3);\n\n// assign row values by sparse array  (where array element 0 is undefined)\nconst values = []\nvalues[5] = 7;\nvalues[10] = 'Hello, World!';\nrow.values = values;\nexpect(row.getCell(1).value).toBeNull();\nexpect(row.getCell(5).value).toEqual(7);\nexpect(row.getCell(10).value).toEqual('Hello, World!');\n\n// assign row values by object, using column keys\nrow.values = {\n  id: 13,\n  name: 'Thing 1',\n  dob: new Date()\n};\n\n// Insert a page break below the row\nrow.addPageBreak();\n\n// Iterate over all rows that have values in a worksheet\nworksheet.eachRow(function(row, rowNumber) {\n  console.log('Row ' + rowNumber + ' = ' + JSON.stringify(row.values));\n});\n\n// Iterate over all rows (including empty rows) in a worksheet\nworksheet.eachRow({ includeEmpty: true }, function(row, rowNumber) {\n  console.log('Row ' + rowNumber + ' = ' + JSON.stringify(row.values));\n});\n\n// Iterate over all non-null cells in a row\nrow.eachCell(function(cell, colNumber) {\n  console.log('Cell ' + colNumber + ' = ' + cell.value);\n});\n\n// Iterate over all cells in a row (including empty cells)\nrow.eachCell({ includeEmpty: true }, function(cell, colNumber) {\n  console.log('Cell ' + colNumber + ' = ' + cell.value);\n});\n\n// Commit a completed row to stream\nrow.commit();\n\n// row metrics\nconst rowSize = row.cellCount;\nconst numValues = row.actualCellCount;\n```\n\n## Add Rows[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\n// Add a couple of Rows by key-value, after the last current row, using the column keys\nworksheet.addRow({id: 1, name: 'John Doe', dob: new Date(1970,1,1)});\nworksheet.addRow({id: 2, name: 'Jane Doe', dob: new Date(1965,1,7)});\n\n// Add a row by contiguous Array (assign to columns A, B \u0026 C)\nworksheet.addRow([3, 'Sam', new Date()]);\n\n// Add a row by sparse Array (assign to columns A, E \u0026 I)\nconst rowValues = [];\nrowValues[1] = 4;\nrowValues[5] = 'Kyle';\nrowValues[9] = new Date();\nworksheet.addRow(rowValues);\n\n// Add a row with inherited style\n// This new row will have same style as last row\n// And return as row object\nconst newRow = worksheet.addRow(rowValues, 'i');\n\n// Add an array of rows\nconst rows = [\n  [5,'Bob',new Date()], // row by array\n  {id:6, name: 'Barbara', dob: new Date()}\n];\n// add new rows and return them as array of row objects\nconst newRows = worksheet.addRows(rows);\n\n// Add an array of rows with inherited style\n// These new rows will have same styles as last row\n// and return them as array of row objects\nconst newRowsStyled = worksheet.addRows(rows, 'i');\n```\n| Parameter | Description | Default Value |\n| -------------- | ----------------- | -------- |\n| value/s    | The new row/s values |  |\n| style            | 'i' for inherit from row above, 'i+' to include empty cells, 'n' for none | *'n'* |\n\n## Handling Individual Cells[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\nconst cell = worksheet.getCell('C3');\n\n// Modify/Add individual cell\ncell.value = new Date(1968, 5, 1);\n\n// query a cell's type\nexpect(cell.type).toEqual(Excel.ValueType.Date);\n\n// use string value of cell\nmyInput.value = cell.text;\n\n// use html-safe string for rendering...\nconst html = '\u003cdiv\u003e' + cell.html + '\u003c/div\u003e';\n\n```\n\n## Merged Cells[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\n// merge a range of cells\nworksheet.mergeCells('A4:B5');\n\n// ... merged cells are linked\nworksheet.getCell('B5').value = 'Hello, World!';\nexpect(worksheet.getCell('B5').value).toBe(worksheet.getCell('A4').value);\nexpect(worksheet.getCell('B5').master).toBe(worksheet.getCell('A4'));\n\n// ... merged cells share the same style object\nexpect(worksheet.getCell('B5').style).toBe(worksheet.getCell('A4').style);\nworksheet.getCell('B5').style.font = myFonts.arial;\nexpect(worksheet.getCell('A4').style.font).toBe(myFonts.arial);\n\n// unmerging the cells breaks the style links\nworksheet.unMergeCells('A4');\nexpect(worksheet.getCell('B5').style).not.toBe(worksheet.getCell('A4').style);\nexpect(worksheet.getCell('B5').style.font).not.toBe(myFonts.arial);\n\n// merge by top-left, bottom-right\nworksheet.mergeCells('K10', 'M12');\n\n// merge by start row, start column, end row, end column (equivalent to K10:M12)\nworksheet.mergeCells(10,11,12,13);\n```\n\n## Insert Rows[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\ninsertRow(pos, value, style = 'n')\ninsertRows(pos, values, style = 'n')\n\n// Insert a couple of Rows by key-value, shifting down rows every time\nworksheet.insertRow(1, {id: 1, name: 'John Doe', dob: new Date(1970,1,1)});\nworksheet.insertRow(1, {id: 2, name: 'Jane Doe', dob: new Date(1965,1,7)});\n\n// Insert a row by contiguous Array (assign to columns A, B \u0026 C)\nworksheet.insertRow(1, [3, 'Sam', new Date()]);\n\n// Insert a row by sparse Array (assign to columns A, E \u0026 I)\nvar rowValues = [];\nrowValues[1] = 4;\nrowValues[5] = 'Kyle';\nrowValues[9] = new Date();\n// insert new row and return as row object\nconst insertedRow = worksheet.insertRow(1, rowValues);\n\n// Insert a row, with inherited style\n// This new row will have same style as row on top of it\n// And return as row object\nconst insertedRowInherited = worksheet.insertRow(1, rowValues, 'i');\n\n// Insert a row, keeping original style\n// This new row will have same style as it was previously\n// And return as row object\nconst insertedRowOriginal = worksheet.insertRow(1, rowValues, 'o');\n\n// Insert an array of rows, in position 1, shifting down current position 1 and later rows by 2 rows\nvar rows = [\n  [5,'Bob',new Date()], // row by array\n  {id:6, name: 'Barbara', dob: new Date()}\n];\n// insert new rows and return them as array of row objects\nconst insertedRows = worksheet.insertRows(1, rows);\n\n// Insert an array of rows, with inherited style\n// These new rows will have same style as row on top of it\n// And return them as array of row objects\nconst insertedRowsInherited = worksheet.insertRows(1, rows, 'i');\n\n// Insert an array of rows, keeping original style\n// These new rows will have same style as it was previously in 'pos' position\nconst insertedRowsOriginal = worksheet.insertRows(1, rows, 'o');\n\n```\n| Parameter | Description | Default Value |\n| -------------- | ----------------- | -------- |\n| pos          | Row number where you want to insert, pushing down all rows from there |  |\n| value/s    | The new row/s values |  |\n| style            | 'i' for inherit from row above, , 'i+' to include empty cells, 'o' for original style, 'o+' to include empty cells, 'n' for none | *'n'* |\n\n## Splice[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\n// Cut one or more rows (rows below are shifted up)\n// Known Issue: If a splice causes any merged cells to move, the results may be unpredictable\nworksheet.spliceRows(4, 3);\n\n// remove one row and insert two more.\n// Note: rows 4 and below will be shifted down by 1 row.\nconst newRow3Values = [1, 2, 3, 4, 5];\nconst newRow4Values = ['one', 'two', 'three', 'four', 'five'];\nworksheet.spliceRows(3, 1, newRow3Values, newRow4Values);\n\n// Cut one or more cells (cells to the right are shifted left)\n// Note: this operation will not affect other rows\nrow.splice(3, 2);\n\n// remove one cell and insert two more (cells to the right of the cut cell will be shifted right)\nrow.splice(4, 1, 'new value 1', 'new value 2');\n```\n| Parameter | Description | Default Value |\n| -------------- | ----------------- | -------- |\n| start    | Starting point to splice from |  |\n| count    | Number of rows/cells to remove |  |\n| ...inserts            | New row/cell values to insert |  |\n\n## Duplicate a Row[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\nduplicateRow(start, amount = 1, insert = true)\n\nconst wb = new ExcelJS.Workbook();\nconst ws = wb.addWorksheet('duplicateTest');\nws.getCell('A1').value = 'One';\nws.getCell('A2').value = 'Two';\nws.getCell('A3').value = 'Three';\nws.getCell('A4').value = 'Four';\n\n// This line will duplicate the row 'One' twice but it will replace rows 'Two' and 'Three'\n// if third param was true so it would insert 2 new rows with the values and styles of row 'One'\nws.duplicateRow(1,2,false);\n```\n\n| Parameter | Description | Default Value |\n| -------------- | ----------------- | -------- |\n| start          | Row number you want to duplicate (first in excel is 1) |  |\n| amount    | The times you want to duplicate the row | 1 |\n| insert            | *true* if you want to insert new rows for the duplicates, or *false* if you want to replace them | *true* |\n\n\n\n## Defined Names[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nIndividual cells (or multiple groups of cells) can have names assigned to them.\n The names can be used in formulas and data validation (and probably more).\n\n```javascript\n// assign (or get) a name for a cell (will overwrite any other names that cell had)\nworksheet.getCell('A1').name = 'PI';\nexpect(worksheet.getCell('A1').name).to.equal('PI');\n\n// assign (or get) an array of names for a cell (cells can have more than one name)\nworksheet.getCell('A1').names = ['thing1', 'thing2'];\nexpect(worksheet.getCell('A1').names).to.have.members(['thing1', 'thing2']);\n\n// remove a name from a cell\nworksheet.getCell('A1').removeName('thing1');\nexpect(worksheet.getCell('A1').names).to.have.members(['thing2']);\n```\n\n## Data Validations[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nCells can define what values are valid or not and provide prompting to the user to help guide them.\n\nValidation types can be one of the following:\n\n| Type       | Description |\n| ---------- | ----------- |\n| list       | Define a discrete set of valid values. Excel will offer these in a dropdown for easy entry |\n| whole      | The value must be a whole number |\n| decimal    | The value must be a decimal number |\n| textLength | The value may be text but the length is controlled |\n| custom     | A custom formula controls the valid values |\n\nFor types other than list or custom, the following operators affect the validation:\n\n| Operator              | Description |\n| --------------------  | ----------- |\n| between               | Values must lie between formula results |\n| notBetween            | Values must not lie between formula results |\n| equal                 | Value must equal formula result |\n| notEqual              | Value must not equal formula result |\n| greaterThan           | Value must be greater than formula result |\n| lessThan              | Value must be less than formula result |\n| greaterThanOrEqual    | Value must be greater than or equal to formula result |\n| lessThanOrEqual       | Value must be less than or equal to formula result |\n\n```javascript\n// Specify list of valid values (One, Two, Three, Four).\n// Excel will provide a dropdown with these values.\nworksheet.getCell('A1').dataValidation = {\n  type: 'list',\n  allowBlank: true,\n  formulae: ['\"One,Two,Three,Four\"']\n};\n\n// Specify list of valid values from a range.\n// Excel will provide a dropdown with these values.\nworksheet.getCell('A1').dataValidation = {\n  type: 'list',\n  allowBlank: true,\n  formulae: ['$D$5:$F$5']\n};\n\n// Specify Cell must be a whole number that is not 5.\n// Show the user an appropriate error message if they get it wrong\nworksheet.getCell('A1').dataValidation = {\n  type: 'whole',\n  operator: 'notEqual',\n  showErrorMessage: true,\n  formulae: [5],\n  errorStyle: 'error',\n  errorTitle: 'Five',\n  error: 'The value must not be Five'\n};\n\n// Specify Cell must be a decimal number between 1.5 and 7.\n// Add 'tooltip' to help guid the user\nworksheet.getCell('A1').dataValidation = {\n  type: 'decimal',\n  operator: 'between',\n  allowBlank: true,\n  showInputMessage: true,\n  formulae: [1.5, 7],\n  promptTitle: 'Decimal',\n  prompt: 'The value must between 1.5 and 7'\n};\n\n// Specify Cell must be have a text length less than 15\nworksheet.getCell('A1').dataValidation = {\n  type: 'textLength',\n  operator: 'lessThan',\n  showErrorMessage: true,\n  allowBlank: true,\n  formulae: [15]\n};\n\n// Specify Cell must be have be a date before 1st Jan 2016\nworksheet.getCell('A1').dataValidation = {\n  type: 'date',\n  operator: 'lessThan',\n  showErrorMessage: true,\n  allowBlank: true,\n  formulae: [new Date(2016,0,1)]\n};\n```\n\n## Cell Comments[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nAdd old style comment to a cell\n\n```javascript\n// plain text note\nworksheet.getCell('A1').note = 'Hello, ExcelJS!';\n\n// colourful formatted note\nws.getCell('B1').note = {\n  texts: [\n    {'font': {'size': 12, 'color': {'theme': 0}, 'name': 'Calibri', 'family': 2, 'scheme': 'minor'}, 'text': 'This is '},\n    {'font': {'italic': true, 'size': 12, 'color': {'theme': 0}, 'name': 'Calibri', 'scheme': 'minor'}, 'text': 'a'},\n    {'font': {'size': 12, 'color': {'theme': 1}, 'name': 'Calibri', 'family': 2, 'scheme': 'minor'}, 'text': ' '},\n    {'font': {'size': 12, 'color': {'argb': 'FFFF6600'}, 'name': 'Calibri', 'scheme': 'minor'}, 'text': 'colorful'},\n    {'font': {'size': 12, 'color': {'theme': 1}, 'name': 'Calibri', 'family': 2, 'scheme': 'minor'}, 'text': ' text '},\n    {'font': {'size': 12, 'color': {'argb': 'FFCCFFCC'}, 'name': 'Calibri', 'scheme': 'minor'}, 'text': 'with'},\n    {'font': {'size': 12, 'color': {'theme': 1}, 'name': 'Calibri', 'family': 2, 'scheme': 'minor'}, 'text': ' in-cell '},\n    {'font': {'bold': true, 'size': 12, 'color': {'theme': 1}, 'name': 'Calibri', 'family': 2, 'scheme': 'minor'}, 'text': 'format'},\n  ],\n  margins: {\n    insetmode: 'custom',\n    inset: [0.25, 0.25, 0.35, 0.35]\n  },\n  protection: {\n    locked: True,\n    lockText: False\n  },\n  editAs: 'twoCells',\n};\n```\n\n### Cell Comments Properties[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nThe following table defines the properties supported by cell comments.\n\n| Field     | Required | Default Value | Description |\n| --------  | -------- | ------------- | ----------- |\n| texts     | Y        |               | The text of the comment |\n| margins | N        | {}  | Determines the value of margins for automatic or custom cell comments\n| protection   | N        | {} | Specifying the lock status of objects and object text using protection attributes |\n| editAs   | N        | 'absolute' | Use the 'editAs' attribute to specify how the annotation is anchored to the cell  |\n\n### Cell Comments Margins\n\nDetermine the page margin setting mode of the cell annotation, automatic or custom mode.\n\n```javascript\nws.getCell('B1').note.margins = {\n  insetmode: 'custom',\n  inset: [0.25, 0.25, 0.35, 0.35]\n}\n```\n\n### Supported Margins Properties[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n| Property     | Required | Default Value | Description |\n| --------  | -------- | ------------- | ----------- |\n| insetmode     | N        |    'auto'           | Determines whether comment margins are set automatically and the value is 'auto' or 'custom' |\n| inset | N        | [0.13, 0.13, 0.25, 0.25]  | Whitespace on the borders of the comment. Units are centimeter. Direction is left, top, right, bottom |\n\nNote: This  ```inset``` setting takes effect only when the value of ```insetmode``` is 'custom'.\n\n### Cell Comments Protection\n\nSpecifying the lock status of objects and object text using protection attributes.\n\n```javascript\nws.getCell('B1').note.protection = {\n  locked: 'False',\n  lockText: 'False',\n};\n```\n\n### Supported Protection Properties[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n| Property     | Required | Default Value | Description |\n| --------  | -------- | ------------- | ----------- |\n| locked     | N        |    'True'           | This element specifies that the object is locked when the sheet is protected |\n| lockText | N        | 'True'  | This element specifies that the text of the object is locked |\n\nNote: Locked objects are valid only when the worksheet is protected.\n\n### Cell Comments EditAs[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nThe cell comments can also have the property 'editAs' which will control how the comments is anchored to the cell(s).\nIt can have one of the following values:\n\n```javascript\nws.getCell('B1').note.editAs = 'twoCells';\n```\n\n| Value     | Description |\n| --------- | ----------- |\n| twoCells | It specifies that the size and position of the note varies with cells |\n| oneCells   | It specifies that the size of the note is fixed and the position changes with the cell |\n| absolute  | This is the default. Comments will not be moved or sized with cells |\n\n## Tables[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nTables allow for in-sheet manipulation of tabular data.\n\nTo add a table to a worksheet, define a table model and call addTable:\n\n```javascript\n// add a table to a sheet\nws.addTable({\n  name: 'MyTable',\n  ref: 'A1',\n  headerRow: true,\n  totalsRow: true,\n  style: {\n    theme: 'TableStyleDark3',\n    showRowStripes: true,\n  },\n  columns: [\n    {name: 'Date', totalsRowLabel: 'Totals:', filterButton: true},\n    {name: 'Amount', totalsRowFunction: 'sum', filterButton: false},\n  ],\n  rows: [\n    [new Date('2019-07-20'), 70.10],\n    [new Date('2019-07-21'), 70.60],\n    [new Date('2019-07-22'), 70.10],\n  ],\n});\n```\n\nNote: Adding a table to a worksheet will modify the sheet by placing\nheaders and row data to the sheet.\nAny data on the sheet covered by the resulting table (including headers and\ntotals) will be overwritten.\n\n### Table Properties[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nThe following table defines the properties supported by tables.\n\n| Table Property | Description       | Required | Default Value |\n| -------------- | ----------------- | -------- | ------------- |\n| name           | The name of the table | Y |    |\n| displayName    | The display name of the table | N | name |\n| ref            | Top left cell of the table | Y |   |\n| headerRow      | Show headers at top of table | N | true |\n| totalsRow      | Show totals at bottom of table | N | false |\n| style          | Extra style properties | N | {} |\n| columns        | Column definitions | Y |   |\n| rows           | Rows of data | Y |   |\n\n### Table Style Properties[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nThe following table defines the properties supported within the table\nstyle property.\n\n| Style Property     | Description       | Required | Default Value |\n| ------------------ | ----------------- | -------- | ------------- |\n| theme              | The colour theme of the table | N |  'TableStyleMedium2'  |\n| showFirstColumn    | Highlight the first column (bold) | N |  false  |\n| showLastColumn     | Highlight the last column (bold) | N |  false  |\n| showRowStripes     | Alternate rows shown with background colour | N |  false  |\n| showColumnStripes  | Alternate rows shown with background colour | N |  false  |\n\n### Table Column Properties[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nThe following table defines the properties supported within each table\ncolumn.\n\n| Column Property    | Description       | Required | Default Value |\n| ------------------ | ----------------- | -------- | ------------- |\n| name               | The name of the column, also used in the header | Y |    |\n| filterButton       | Switches the filter control in the header | N |  false  |\n| totalsRowLabel     | Label to describe the totals row (first column) | N | 'Total' |\n| totalsRowFunction  | Name of the totals function | N | 'none' |\n| totalsRowFormula   | Optional formula for custom functions | N |   |\n\n### Totals Functions[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nThe following table list the valid values for the totalsRowFunction property\ndefined by columns. If any value other than 'custom' is used, it is not\nnecessary to include the associated formula as this will be inserted\nby the table.\n\n| Totals Functions   | Description       |\n| ------------------ | ----------------- |\n| none               | No totals function for this column |\n| average            | Compute average for the column |\n| countNums          | Count the entries that are numbers |\n| count              | Count of entries |\n| max                | The maximum value in this column |\n| min                | The minimum value in this column |\n| stdDev             | The standard deviation for this column |\n| var                | The variance for this column |\n| sum                | The sum of entries for this column |\n| custom             | A custom formula. Requires an associated totalsRowFormula value. |\n\n### Table Style Themes[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nValid theme names follow the following pattern:\n\n* \"TableStyle[Shade][Number]\"\n\nShades, Numbers can be one of:\n\n* Light, 1-21\n* Medium, 1-28\n* Dark, 1-11\n\nFor no theme, use the value null.\n\nNote: custom table themes are not supported by exceljs yet.\n\n### Modifying Tables[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nTables support a set of manipulation functions that allow data to be\nadded or removed and some properties to be changed. Since many of these\noperations may have on-sheet effects, the changes must be committed\nonce complete.\n\nAll index values in the table are zero based, so the first row number\nand first column number is 0.\n\n**Adding or Removing Headers and Totals**\n\n```javascript\nconst table = ws.getTable('MyTable');\n\n// turn header row on\ntable.headerRow = true;\n\n// turn totals row off\ntable.totalsRow = false;\n\n// commit the table changes into the sheet\ntable.commit();\n```\n\n**Relocating a Table**\n\n```javascript\nconst table = ws.getTable('MyTable');\n\n// table top-left move to D4\ntable.ref = 'D4';\n\n// commit the table changes into the sheet\ntable.commit();\n```\n\n**Adding and Removing Rows**\n\n```javascript\nconst table = ws.getTable('MyTable');\n\n// remove first two rows\ntable.removeRows(0, 2);\n\n// insert new rows at index 5\ntable.addRow([new Date('2019-08-05'), 5, 'Mid'], 5);\n\n// append new row to bottom of table\ntable.addRow([new Date('2019-08-10'), 10, 'End']);\n\n// commit the table changes into the sheet\ntable.commit();\n```\n\n**Adding and Removing Columns**\n\n```javascript\nconst table = ws.getTable('MyTable');\n\n// remove second column\ntable.removeColumns(1, 1);\n\n// insert new column (with data) at index 1\ntable.addColumn(\n  {name: 'Letter', totalsRowFunction: 'custom', totalsRowFormula: 'ROW()', totalsRowResult: 6, filterButton: true},\n  ['a', 'b', 'c', 'd'],\n  2\n);\n\n// commit the table changes into the sheet\ntable.commit();\n```\n\n**Change Column Properties**\n\n```javascript\nconst table = ws.getTable('MyTable');\n\n// Get Column Wrapper for second column\nconst column = table.getColumn(1);\n\n// set some properties\ncolumn.name = 'Code';\ncolumn.filterButton = true;\ncolumn.style = {font:{bold: true, name: 'Comic Sans MS'}};\ncolumn.totalsRowLabel = 'Totals';\ncolumn.totalsRowFunction = 'custom';\ncolumn.totalsRowFormula = 'ROW()';\ncolumn.totalsRowResult = 10;\n\n// commit the table changes into the sheet\ntable.commit();\n```\n\n\n## Styles[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nCells, Rows and Columns each support a rich set of styles and formats that affect how the cells are displayed.\n\nStyles are set by assigning the following properties:\n\n* \u003ca href=\"#number-formats\"\u003enumFmt\u003c/a\u003e\n* \u003ca href=\"#fonts\"\u003efont\u003c/a\u003e\n* \u003ca href=\"#alignment\"\u003ealignment\u003c/a\u003e\n* \u003ca href=\"#borders\"\u003eborder\u003c/a\u003e\n* \u003ca href=\"#fills\"\u003efill\u003c/a\u003e\n\n```javascript\n// assign a style to a cell\nws.getCell('A1').numFmt = '0.00%';\n\n// Apply styles to worksheet columns\nws.columns = [\n  { header: 'Id', key: 'id', width: 10 },\n  { header: 'Name', key: 'name', width: 32, style: { font: { name: 'Arial Black' } } },\n  { header: 'D.O.B.', key: 'DOB', width: 10, style: { numFmt: 'dd/mm/yyyy' } }\n];\n\n// Set Column 3 to Currency Format\nws.getColumn(3).numFmt = '\"£\"#,##0.00;[Red]\\-\"£\"#,##0.00';\n\n// Set Row 2 to Comic Sans.\nws.getRow(2).font = { name: 'Comic Sans MS', family: 4, size: 16, underline: 'double', bold: true };\n```\n\nWhen a style is applied to a row or column, it will be applied to all currently existing cells in that row or column.\n Also, any new cell that is created will inherit its initial styles from the row and column it belongs to.\n\nIf a cell's row and column both define a specific style (e.g. font), the cell will use the row style over the column style.\n However if the row and column define different styles (e.g. column.numFmt and row.font), the cell will inherit the font from the row and the numFmt from the column.\n\nCaveat: All the above properties (with the exception of numFmt, which is a string), are JS object structures.\n If the same style object is assigned to more than one spreadsheet entity, then each entity will share the same style object.\n If the style object is later modified before the spreadsheet is serialized, then all entities referencing that style object will be modified too.\n This behaviour is intended to prioritize performance by reducing the number of JS objects created.\n If you want the style objects to be independent, you will need to clone them before assigning them.\n Also, by default, when a document is read from file (or stream) if spreadsheet entities share similar styles, then they will reference the same style object too.\n\n### Number Formats[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\n// display value as '1 3/5'\nws.getCell('A1').value = 1.6;\nws.getCell('A1').numFmt = '# ?/?';\n\n// display value as '1.60%'\nws.getCell('B1').value = 0.016;\nws.getCell('B1').numFmt = '0.00%';\n```\n\n### Fonts[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\n\n// for the wannabe graphic designers out there\nws.getCell('A1').font = {\n  name: 'Comic Sans MS',\n  family: 4,\n  size: 16,\n  underline: true,\n  bold: true\n};\n\n// for the graduate graphic designers...\nws.getCell('A2').font = {\n  name: 'Arial Black',\n  color: { argb: 'FF00FF00' },\n  family: 2,\n  size: 14,\n  italic: true\n};\n\n// for the vertical align\nws.getCell('A3').font = {\n  vertAlign: 'superscript'\n};\n\n// note: the cell will store a reference to the font object assigned.\n// If the font object is changed afterwards, the cell font will change also...\nconst font = { name: 'Arial', size: 12 };\nws.getCell('A3').font = font;\nfont.size = 20; // Cell A3 now has font size 20!\n\n// Cells that share similar fonts may reference the same font object after\n// the workbook is read from file or stream\n```\n\n| Font Property | Description       | Example Value(s) |\n| ------------- | ----------------- | ---------------- |\n| name          | Font name. | 'Arial', 'Calibri', etc. |\n| family        | Font family for fallback. An integer value. | 1 - Serif, 2 - Sans Serif, 3 - Mono, Others - unknown |\n| scheme        | Font scheme. | 'minor', 'major', 'none' |\n| charset       | Font charset. An integer value. | 1, 2, etc. |\n| size          | Font size. An integer value. | 9, 10, 12, 16, etc. |\n| color         | Colour description, an object containing an ARGB value. | { argb: 'FFFF0000'} |\n| bold          | Font **weight** | true, false |\n| italic        | Font *slope* | true, false |\n| underline     | Font \u003cu\u003eunderline\u003c/u\u003e style | true, false, 'none', 'single', 'double', 'singleAccounting', 'doubleAccounting' |\n| strike        | Font \u003cstrike\u003estrikethrough\u003c/strike\u003e | true, false |\n| outline       | Font outline | true, false |\n| vertAlign     | Vertical align | 'superscript', 'subscript'\n\n### Alignment[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\n// set cell alignment to top-left, middle-center, bottom-right\nws.getCell('A1').alignment = { vertical: 'top', horizontal: 'left' };\nws.getCell('B1').alignment = { vertical: 'middle', horizontal: 'center' };\nws.getCell('C1').alignment = { vertical: 'bottom', horizontal: 'right' };\n\n// set cell to wrap-text\nws.getCell('D1').alignment = { wrapText: true };\n\n// set cell indent to 1\nws.getCell('E1').alignment = { indent: 1 };\n\n// set cell text rotation to 30deg upwards, 45deg downwards and vertical text\nws.getCell('F1').alignment = { textRotation: 30 };\nws.getCell('G1').alignment = { textRotation: -45 };\nws.getCell('H1').alignment = { textRotation: 'vertical' };\n```\n\n**Valid Alignment Property Values**\n\n| horizontal       | vertical    | wrapText | shrinkToFit | indent  | readingOrder | textRotation |\n| ---------------- | ----------- | -------- | ----------- | ------- | ------------ | ------------ |\n| left             | top         | true     | true        | integer | rtl          | 0 to 90      |\n| center           | middle      | false    | false       |         | ltr          | -1 to -90    |\n| right            | bottom      |          |             |         |              | vertical     |\n| fill             | distributed |          |             |         |              |              |\n| justify          | justify     |          |             |         |              |              |\n| centerContinuous |             |          |             |         |              |              |\n| distributed      |             |          |             |         |              |              |\n\n\n### Borders[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\n// set single thin border around A1\nws.getCell('A1').border = {\n  top: {style:'thin'},\n  left: {style:'thin'},\n  bottom: {style:'thin'},\n  right: {style:'thin'}\n};\n\n// set double thin green border around A3\nws.getCell('A3').border = {\n  top: {style:'double', color: {argb:'FF00FF00'}},\n  left: {style:'double', color: {argb:'FF00FF00'}},\n  bottom: {style:'double', color: {argb:'FF00FF00'}},\n  right: {style:'double', color: {argb:'FF00FF00'}}\n};\n\n// set thick red cross in A5\nws.getCell('A5').border = {\n  diagonal: {up: true, down: true, style:'thick', color: {argb:'FFFF0000'}}\n};\n```\n\n**Valid Border Styles**\n\n* thin\n* dotted\n* dashDot\n* hair\n* dashDotDot\n* slantDashDot\n* mediumDashed\n* mediumDashDotDot\n* mediumDashDot\n* medium\n* double\n* thick\n\n### Fills[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\n// fill A1 with red darkVertical stripes\nws.getCell('A1').fill = {\n  type: 'pattern',\n  pattern:'darkVertical',\n  fgColor:{argb:'FFFF0000'}\n};\n\n// fill A2 with yellow dark trellis and blue behind\nws.getCell('A2').fill = {\n  type: 'pattern',\n  pattern:'darkTrellis',\n  fgColor:{argb:'FFFFFF00'},\n  bgColor:{argb:'FF0000FF'}\n};\n\n// fill A3 with solid coral\nws.getCell('A3').fill = {\n  type: 'pattern',\n  pattern:'solid',\n  fgColor:{argb:'F08080'},\n};\n\n// fill A4 with blue-white-blue gradient from left to right\nws.getCell('A4').fill = {\n  type: 'gradient',\n  gradient: 'angle',\n  degree: 0,\n  stops: [\n    {position:0, color:{argb:'FF0000FF'}},\n    {position:0.5, color:{argb:'FFFFFFFF'}},\n    {position:1, color:{argb:'FF0000FF'}}\n  ]\n};\n\n\n// fill A5 with red-green gradient from center\nws.getCell('A5').fill = {\n  type: 'gradient',\n  gradient: 'path',\n  center:{left:0.5,top:0.5},\n  stops: [\n    {position:0, color:{argb:'FFFF0000'}},\n    {position:1, color:{argb:'FF00FF00'}}\n  ]\n};\n```\n\n#### Pattern Fills[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n| Property | Required | Description |\n| -------- | -------- | ----------- |\n| type     | Y        | Value: 'pattern'\u003cbr/\u003eSpecifies this fill uses patterns |\n| pattern  | Y        | Specifies type of pattern (see \u003ca href=\"#valid-pattern-types\"\u003eValid Pattern Types\u003c/a\u003e below) |\n| fgColor  | N        | Specifies the pattern foreground color. Default is black. |\n| bgColor  | N        | Specifies the pattern background color. Default is white. |\n\nNote: If you want to fill a cell using the `solid` pattern, then you don't need to specify `bgColor`.\nSee example above for cell `A3` with a `solid` pattern and a coral `fgColor`.\n\n\n**Valid Pattern Types**\n\n* none\n* solid\n* darkGray\n* mediumGray\n* lightGray\n* gray125\n* gray0625\n* darkHorizontal\n* darkVertical\n* darkDown\n* darkUp\n* darkGrid\n* darkTrellis\n* lightHorizontal\n* lightVertical\n* lightDown\n* lightUp\n* lightGrid\n* lightTrellis\n\n#### Gradient Fills[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n| Property | Required | Description |\n| -------- | -------- | ----------- |\n| type     | Y        | Value: 'gradient'\u003cbr/\u003eSpecifies this fill uses gradients |\n| gradient | Y        | Specifies gradient type. One of ['angle', 'path'] |\n| degree   | angle    | For 'angle' gradient, specifies the direction of the gradient. 0 is from the left to the right. Values from 1 - 359 rotates the direction clockwise |\n| center   | path     | For 'path' gradient. Specifies the relative coordinates for the start of the path. 'left' and 'top' values range from 0 to 1 |\n| stops    | Y        | Specifies the gradient colour sequence. Is an array of objects containing position and color starting with position 0 and ending with position 1. Intermediary positions may be used to specify other colours on the path. |\n\n**Caveats**\n\nUsing the interface above it may be possible to create gradient fill effects not possible using the XLSX editor program.\nFor example, Excel only supports angle gradients of 0, 45, 90 and 135.\nSimilarly the sequence of stops may also be limited by the UI with positions [0,1] or [0,0.5,1] as the only options.\nTake care with this fill to be sure it is supported by the target XLSX viewers.\n\n### Rich Text[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nIndividual cells now support rich text or in-cell formatting.\n Rich text values can control the font properties of any number of sub-strings within the text value.\n See \u003ca href=\"font\"\u003eFonts\u003c/a\u003e for a complete list of details on what font properties are supported.\n\n```javascript\n\nws.getCell('A1').value = {\n  'richText': [\n    {'font': {'size': 12,'color': {'theme': 0},'name': 'Calibri','family': 2,'scheme': 'minor'},'text': 'This is '},\n    {'font': {'italic': true,'size': 12,'color': {'theme': 0},'name': 'Calibri','scheme': 'minor'},'text': 'a'},\n    {'font': {'size': 12,'color': {'theme': 1},'name': 'Calibri','family': 2,'scheme': 'minor'},'text': ' '},\n    {'font': {'size': 12,'color': {'argb': 'FFFF6600'},'name': 'Calibri','scheme': 'minor'},'text': 'colorful'},\n    {'font': {'size': 12,'color': {'theme': 1},'name': 'Calibri','family': 2,'scheme': 'minor'},'text': ' text '},\n    {'font': {'size': 12,'color': {'argb': 'FFCCFFCC'},'name': 'Calibri','scheme': 'minor'},'text': 'with'},\n    {'font': {'size': 12,'color': {'theme': 1},'name': 'Calibri','family': 2,'scheme': 'minor'},'text': ' in-cell '},\n    {'font': {'bold': true,'size': 12,'color': {'theme': 1},'name': 'Calibri','family': 2,'scheme': 'minor'},'text': 'format'}\n  ]\n};\n\nexpect(ws.getCell('A1').text).to.equal('This is a colorful text with in-cell format');\nexpect(ws.getCell('A1').type).to.equal(Excel.ValueType.RichText);\n\n```\n\n### Cell Protection[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nCell level protection can be modified using the protection property.\n\n```javascript\nws.getCell('A1').protection = {\n  locked: false,\n  hidden: true,\n};\n```\n\n**Supported Protection Properties**\n\n| Property | Default | Description |\n| -------- | ------- | ----------- |\n| locked   | true    | Specifies whether a cell will be locked if the sheet is protected. |\n| hidden   | false   | Specifies whether a cell's formula will be visible if the sheet is protected. |\n\n## Conditional Formatting[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nConditional formatting allows a sheet to show specific styles, icons, etc\ndepending on cell values or any arbitrary formula.\n\nConditional formatting rules are added at the sheet level and will typically\ncover a range of cells.\n\nMultiple rules can be applied to a given cell range and each rule will apply\nits own style.\n\nIf multiple rules affect a given cell, the rule priority value will determine\nwhich rule wins out if competing styles collide.\nThe rule with the lower priority value wins.\nIf priority values are not specified for a given rule, ExcelJS will assign them\nin ascending order.\n\nNote: at present, only a subset of conditional formatting rules are supported.\nSpecifically, only the formatting rules that do not require XML rendering\ninside an \u0026lt;extLst\u0026gt; element. This means that datasets and three specific\nicon sets (3Triangles, 3Stars, 5Boxes) are not supported.\n\n```javascript\n// add a checkerboard pattern to A1:E7 based on row + col being even or odd\nworksheet.addConditionalFormatting({\n  ref: 'A1:E7',\n  rules: [\n    {\n      type: 'expression',\n      formulae: ['MOD(ROW()+COLUMN(),2)=0'],\n      style: {fill: {type: 'pattern', pattern: 'solid', bgColor: {argb: 'FF00FF00'}}},\n    }\n  ]\n})\n```\n\n**Supported Conditional Formatting Rule Types**\n\n| Type         | Description |\n| ------------ | ----------- |\n| expression   | Any custom function may be used to activate the rule. |\n| cellIs       | Compares cell value with supplied formula using specified operator |\n| top10        | Applies formatting to cells with values in top (or bottom) ranges |\n| aboveAverage | Applies formatting to cells with values above (or below) average |\n| colorScale   | Applies a coloured background to cells based on where their values lie in the range |\n| iconSet      | Adds one of a range of icons to cells based on value |\n| containsText | Applies formatting based on whether cell a specific text |\n| timePeriod   | Applies formatting based on whether cell datetime value lies within a specified range |\n\n### Expression[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n| Field    | Optional | Default | Description |\n| -------- | -------- | ------- | ----------- |\n| type     |          |         | 'expression' |\n| priority | Y        | \u0026lt;auto\u0026gt;  | determines priority ordering of styles |\n| formulae |          |         | array of 1 formula string that returns a true/false value. To reference the cell value, use the top-left cell address |\n| style    |          |         | style structure to apply if the formula returns true |\n\n### Cell Is[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n| Field    | Optional | Default | Description |\n| -------- | -------- | ------- | ----------- |\n| type     |          |         | 'cellIs' |\n| priority | Y        | \u0026lt;auto\u0026gt;  | determines priority ordering of styles |\n| operator |          |         | how to compare cell value with formula result |\n| formulae |          |         | array of 1 formula string that returns the value to compare against each cell |\n| style    |          |         | style structure to apply if the comparison returns true |\n\n**Cell Is Operators**\n\n| Operator    | Description |\n| ----------- | ----------- |\n| equal       | Apply format if cell value equals formula value |\n| greaterThan | Apply format if cell value is greater than formula value |\n| lessThan    | Apply format if cell value is less than formula value |\n| between     | Apply format if cell value is between two formula values (inclusive) |\n\n\n### Top 10[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n| Field    | Optional | Default | Description |\n| -------- | -------- | ------- | ----------- |\n| type     |          |         | 'top10' |\n| priority | Y        | \u0026lt;auto\u0026gt;  | determines priority ordering of styles |\n| rank     | Y        | 10      | specifies how many top (or bottom) values are included in the formatting |\n| percent  | Y        | false   | if true, the rank field is a percentage, not an absolute |\n| bottom   | Y        | false   | if true, the bottom values are included instead of the top |\n| style    |          |         | style structure to apply if the comparison returns true |\n\n### Above Average[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n| Field         | Optional | Default | Description |\n| ------------- | -------- | ------- | ----------- |\n| type          |          |         | 'aboveAverage' |\n| priority      | Y        | \u0026lt;auto\u0026gt;  | determines priority ordering of styles |\n| aboveAverage  | Y        | false   | if true, the rank field is a percentage, not an absolute |\n| style         |          |         | style structure to apply if the comparison returns true |\n\n### Color Scale[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n| Field         | Optional | Default | Description |\n| ------------- | -------- | ------- | ----------- |\n| type          |          |         | 'colorScale' |\n| priority      | Y        | \u0026lt;auto\u0026gt;  | determines priority ordering of styles |\n| cfvo          |          |         | array of 2 to 5 Conditional Formatting Value Objects specifying way-points in the value range |\n| color         |          |         | corresponding array of colours to use at given way points |\n| style         |          |         | style structure to apply if the comparison returns true |\n\n### Icon Set[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n| Field         | Optional | Default | Description |\n| ------------- | -------- | ------- | ----------- |\n| type          |          |         | 'iconSet' |\n| priority      | Y        | \u0026lt;auto\u0026gt;  | determines priority ordering of styles |\n| iconSet       | Y        | 3TrafficLights | name of icon set to use |\n| showValue     |          | true    | Specifies whether the cells in the applied range display the icon and cell value, or the icon only |\n| reverse       |          | false   | Specifies whether the icons in the icon set specified in iconSet are show in reserve order. If custom equals \"true\" this value must be ignored |\n| custom        |          |  false  | Specifies whether a custom set of icons is used |\n| cfvo          |          |         | array of 2 to 5 Conditional Formatting Value Objects specifying way-points in the value range |\n| style         |          |         | style structure to apply if the comparison returns true |\n\n### Data Bar[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n| Field      | Optional | Default | Description |\n| ---------- | -------- | ------- | ----------- |\n| type       |          |         | 'dataBar' |\n| priority   | Y        | \u0026lt;auto\u0026gt;  | determines priority ordering of styles |\n| minLength  |          | 0       | Specifies the length of the shortest data bar in this conditional formatting range |\n| maxLength  |          | 100     | Specifies the length of the longest data bar in this conditional formatting range |\n| showValue  |          | true    | Specifies whether the cells in the conditional formatting range display both the data bar and the numeric value or the data bar |\n| gradient   |          | true    | Specifies whether the data bar has a gradient fill |\n| border     |          | true    | Specifies whether the data bar has a border |\n| negativeBarColorSameAsPositive  |                | true        | Specifies whether the data bar has a negative bar color that is different from the positive bar color |\n| negativeBarBorderColorSameAsPositive  |          | true        | Specifies whether the data bar has a negative border color that is different from the positive border color |\n| axisPosition  |       | 'auto'             | Specifies the axis position for the data bar |\n| direction  |          | 'leftToRight'      | Specifies the direction of the data bar |\n| cfvo          |          |         | array of 2 to 5 Conditional Formatting Value Objects specifying way-points in the value range |\n| style         |          |         | style structure to apply if the comparison returns true |\n\n### Contains Text[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n| Field    | Optional | Default | Description |\n| -------- | -------- | ------- | ----------- |\n| type     |          |         | 'containsText' |\n| priority | Y        | \u0026lt;auto\u0026gt;  | determines priority ordering of styles |\n| operator |          |         | type of text comparison |\n| text     |          |         | text to search for |\n| style    |          |         | style structure to apply if the comparison returns true |\n\n**Contains Text Operators**\n\n| Operator          | Description |\n| ----------------- | ----------- |\n| containsText      | Apply format if cell value contains the value specified in the 'text' field |\n| containsBlanks    | Apply format if cell value contains blanks |\n| notContainsBlanks | Apply format if cell value does not contain blanks |\n| containsErrors    | Apply format if cell value contains errors |\n| notContainsErrors | Apply format if cell value does not contain errors |\n\n### Time Period[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n| Field      | Optional | Default | Description |\n| ---------- | -------- | ------- | ----------- |\n| type       |          |         | 'timePeriod' |\n| priority   | Y        | \u0026lt;auto\u0026gt;  | determines priority ordering of styles |\n| timePeriod |          |         | what time period to compare cell value to |\n| style      |          |         | style structure to apply if the comparison returns true |\n\n**Time Periods**\n\n| Time Period       | Description |\n| ----------------- | ----------- |\n| lastWeek          | Apply format if cell value falls within the last week |\n| thisWeek          | Apply format if cell value falls in this week |\n| nextWeek          | Apply format if cell value falls in the next week |\n| yesterday         | Apply format if cell value is equal to yesterday |\n| today             | Apply format if cell value is equal to today |\n| tomorrow          | Apply format if cell value is equal to tomorrow |\n| last7Days         | Apply format if cell value falls within the last 7 days |\n| lastMonth         | Apply format if cell value falls in last month |\n| thisMonth         | Apply format if cell value falls in this month |\n| nextMonth         | Apply format if cell value falls in next month |\n\n## Outline Levels[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nExcel supports outlining; where rows or columns can be expanded or collapsed depending on what level of detail the user wishes to view.\n\nOutline levels can be defined in column setup:\n```javascript\nworksheet.columns = [\n  { header: 'Id', key: 'id', width: 10 },\n  { header: 'Name', key: 'name', width: 32 },\n  { header: 'D.O.B.', key: 'DOB', width: 10, outlineLevel: 1 }\n];\n```\n\nOr directly on the row or column\n```javascript\nworksheet.getColumn(3).outlineLevel = 1;\nworksheet.getRow(3).outlineLevel = 1;\n```\n\nThe sheet outline levels can be set on the worksheet\n```javascript\n// set column outline level\nworksheet.properties.outlineLevelCol = 1;\n\n// set row outline level\nworksheet.properties.outlineLevelRow = 1;\n```\n\nNote: adjusting outline levels on rows or columns or the outline levels on the worksheet will incur a side effect of also modifying the collapsed property of all rows or columns affected by the property change. E.g.:\n```javascript\nworksheet.properties.outlineLevelCol = 1;\n\nworksheet.getColumn(3).outlineLevel = 1;\nexpect(worksheet.getColumn(3).collapsed).to.be.true;\n\nworksheet.properties.outlineLevelCol = 2;\nexpect(worksheet.getColumn(3).collapsed).to.be.false;\n```\n\nThe outline properties can be set on the worksheet\n\n```javascript\nworksheet.properties.outlineProperties = {\n  summaryBelow: false,\n  summaryRight: false,\n};\n```\n\n## Images[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nAdding images to a worksheet is a two-step process.\nFirst, the image is added to the workbook via the addImage() function which will also return an imageId value.\nThen, using the imageId, the image can be added to the worksheet either as a tiled background or covering a cell range.\n\nNote: As of this version, adjusting or transforming the image is not supported and images are not supported in streaming mode.\n\n### Add Image to Workbook[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nThe Workbook.addImage function supports adding images by filename or by Buffer.\nNote that in both cases, the extension must be specified.\nValid extension values include 'jpeg', 'png', 'gif'.\n\n```javascript\n// add image to workbook by filename\nconst imageId1 = workbook.addImage({\n  filename: 'path/to/image.jpg',\n  extension: 'jpeg',\n});\n\n// add image to workbook by buffer\nconst imageId2 = workbook.addImage({\n  buffer: fs.readFileSync('path/to.image.png'),\n  extension: 'png',\n});\n\n// add image to workbook by base64\nconst myBase64Image = \"data:image/png;base64,iVBORw0KG...\";\nconst imageId2 = workbook.addImage({\n  base64: myBase64Image,\n  extension: 'png',\n});\n```\n\n### Add image background to worksheet[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nUsing the image id from Workbook.addImage, the background to a worksheet can be set using the addBackgroundImage function\n\n```javascript\n// set background\nworksheet.addBackgroundImage(imageId1);\n```\n\n### Add image over a range[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nUsing the image id from Workbook.addImage, an image can be embedded within the worksheet to cover a range.\nThe coordinates calculated from the range will cover from the top-left of the first cell to the bottom right of the second.\n\n```javascript\n// insert an image over B2:D6\nworksheet.addImage(imageId2, 'B2:D6');\n```\n\nUsing a structure instead of a range string, it is possible to partially cover cells.\n\nNote that the coordinate system used for this is zero based, so the top-left of A1 will be { col: 0, row: 0 }.\nFractions of cells can be specified by using floating point numbers, e.g. the midpoint of A1 is { col: 0.5, row: 0.5 }.\n\n```javascript\n// insert an image over part of B2:D6\nworksheet.addImage(imageId2, {\n  tl: { col: 1.5, row: 1.5 },\n  br: { col: 3.5, row: 5.5 }\n});\n```\n\nThe cell range can also have the property 'editAs' which will control how the image is anchored to the cell(s)\nIt can have one of the following values:\n\n| Value     | Description |\n| --------- | ----------- |\n| undefined | It specifies the image will be moved and sized with cells |\n| oneCell   | This is the default. Image will be moved with cells but not sized |\n| absolute  | Image will not be moved or sized with cells |\n\n```javascript\nws.addImage(imageId, {\n  tl: { col: 0.1125, row: 0.4 },\n  br: { col: 2.101046875, row: 3.4 },\n  editAs: 'oneCell'\n});\n```\n\n### Add image to a cell[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nYou can add an image to a cell and then define its width and height in pixels at 96dpi.\n\n```javascript\nworksheet.addImage(imageId2, {\n  tl: { col: 0, row: 0 },\n  ext: { width: 500, height: 200 }\n});\n```\n\n### Add image with hyperlinks[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nYou can add an image with hyperlinks to a cell, and defines the hyperlinks in image range.\n\n```javascript\nworksheet.addImage(imageId2, {\n  tl: { col: 0, row: 0 },\n  ext: { width: 500, height: 200 },\n  hyperlinks: {\n    hyperlink: 'http://www.somewhere.com',\n    tooltip: 'http://www.somewhere.com'\n  }\n});\n```\n\n## Sheet Protection[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nWorksheets can be protected from modification by adding a password.\n\n```javascript\nawait worksheet.protect('the-password', options);\n```\n\nWorksheet protection can also be removed:\n\n```javascript\nworksheet.unprotect();\n```\n\n\nSee \u003ca href=\"#cell-protection\"\u003eCell Protection\u003c/a\u003e for details on how\nto modify individual cell protection.\n\n**Note:** While the protect() function returns a Promise indicating\nthat it is async, the current implementation runs on the main\nthread and will use approx 600ms on an average CPU. This can be adjusted\nby setting the spinCount, which can be used to make the process either\nfaster or more resilient.\n\n### Sheet Protection Options[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n| Field               | Default | Description |\n| ------------------- | ------- | ----------- |\n| selectLockedCells   | true    | Lets the user select locked cells |\n| selectUnlockedCells | true    | Lets the user select unlocked cells |\n| formatCells         | false   | Lets the user format cells |\n| formatColumns       | false   | Lets the user format columns |\n| formatRows          | false   | Lets the user format rows |\n| insertRows          | false   | Lets the user insert rows |\n| insertColumns       | false   | Lets the user insert columns |\n| insertHyperlinks    | false   | Lets the user insert hyperlinks |\n| deleteRows          | false   | Lets the user delete rows |\n| deleteColumns       | false   | Lets the user delete columns |\n| sort                | false   | Lets the user sort data |\n| autoFilter          | false   | Lets the user filter data in tables |\n| pivotTables         | false   | Lets the user use pivot tables |\n| spinCount           | 100000  | The number of hash iterations performed when protecting or unprotecting |\n\n\n\n## File I/O[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n### XLSX[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n#### Reading XLSX[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nOptions supported when reading XLSX files.\n\n| Field            |  Required   |    Type     |Description  |\n| ---------------- | ----------- | ----------- | ----------- |\n| ignoreNodes      |     N       |  Array      | A list of node names to ignore while loading the XLSX document. Improves performance in some situations. \u003cbr/\u003e Available: `sheetPr`, `dimension`, `sheetViews `, `sheetFormatPr`, `cols `, `sheetData`, `autoFilter `, `mergeCells `, `rowBreaks`, `hyperlinks `, `pageMargins`, `dataValidations`, `pageSetup`, `headerFooter `, `printOptions `, `picture`, `drawing`, `sheetProtection`, `tableParts `, `conditionalFormatting`, `extLst`,|\n\n```javascript\n// read from a file\nconst workbook = new Excel.Workbook();\nawait workbook.xlsx.readFile(filename);\n// ... use workbook\n\n\n// read from a stream\nconst workbook = new Excel.Workbook();\nawait workbook.xlsx.read(stream);\n// ... use workbook\n\n\n// load from buffer\nconst workbook = new Excel.Workbook();\nawait workbook.xlsx.load(data);\n// ... use workbook\n\n\n// using additional options\nconst workbook = new Excel.Workbook();\nawait workbook.xlsx.load(data, {\n  ignoreNodes: [\n    'dataValidations' // ignores the workbook's Data Validations\n  ],\n});\n// ... use workbook\n```\n\n#### Writing XLSX[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n```javascript\n// write to a file\nconst workbook = createAndFillWorkbook();\nawait workbook.xlsx.writeFile(filename);\n\n// write to a stream\nawait workbook.xlsx.write(stream);\n\n// write to a new buffer\nconst buffer = await workbook.xlsx.writeBuffer();\n```\n\n### CSV[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n#### Reading CSV[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nOptions supported when reading CSV files.\n\n| Field            |  Required   |    Type     |Description  |\n| ---------------- | ----------- | ----------- | ----------- |\n| dateFormats      |     N       |  Array      | Specify the date encoding format of dayjs. |\n| map              |     N       |  Function   | Custom Array.prototype.map() callback function for processing data. |\n| sheetName        |     N       |  String     | Specify worksheet name. |\n| parserOptions    |     N       |  Object     | [parseOptions options](https://c2fo.github.io/fast-csv/docs/parsing/options)  @fast-csv/format module to write csv data. |\n\n```javascript\n// read from a file\nconst workbook = new Excel.Workbook();\nconst worksheet = await workbook.csv.readFile(filename);\n// ... use workbook or worksheet\n\n\n// read from a stream\nconst workbook = new Excel.Workbook();\nconst worksheet = await workbook.csv.read(stream);\n// ... use workbook or worksheet\n\n\n// read from a file with European Dates\nconst workbook = new Excel.Workbook();\nconst options = {\n  dateFormats: ['DD/MM/YYYY']\n};\nconst worksheet = await workbook.csv.readFile(filename, options);\n// ... use workbook or worksheet\n\n\n// read from a file with custom value parsing\nconst workbook = new Excel.Workbook();\nconst options = {\n  map(value, index) {\n    switch(index) {\n      case 0:\n        // column 1 is string\n        return value;\n      case 1:\n        // column 2 is a date\n        return new Date(value);\n      case 2:\n        // column 3 is JSON of a formula value\n        return JSON.parse(value);\n      default:\n        // the rest are numbers\n        return parseFloat(value);\n    }\n  },\n  // https://c2fo.github.io/fast-csv/docs/parsing/options\n  parserOptions: {\n    delimiter: '\\t',\n    quote: false,\n  },\n};\nconst worksheet = await workbook.csv.readFile(filename, options);\n// ... use workbook or worksheet\n```\n\nThe CSV parser uses [fast-csv](https://www.npmjs.com/package/fast-csv) to read the CSV file.\nThe formatterOptions in the options passed to the above write function will be passed to the @fast-csv/format module to write csv data.\n Please refer to the fast-csv README.md for details.\n\nDates are parsed using the npm module [dayjs](https://www.npmjs.com/package/dayjs).\n If a dateFormats array is not supplied, the following dateFormats are used:\n\n* 'YYYY-MM-DD\\[T\\]HH:mm:ss'\n* 'MM-DD-YYYY'\n* 'YYYY-MM-DD'\n\nPlease refer to the [dayjs CustomParseFormat plugin](https://github.com/iamkun/dayjs/blob/HEAD/docs/en/Plugin.md#customparseformat) for details on how to structure a dateFormat.\n\n#### Writing CSV[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nOptions supported when writing to a CSV file.\n\n| Field            |  Required   |    Type     | Description |\n| ---------------- | ----------- | ----------- | ----------- |\n| dateFormat       |     N       |  String     | Specify the date encoding format of dayjs. |\n| dateUTC          |     N       |  Boolean    | Specify whether ExcelJS uses `dayjs.utc ()` to convert time zone for parsing dates. |\n| encoding         |     N       |  String     | Specify file encoding format. (Only applies to `.writeFile`.) |\n| includeEmptyRows |     N       |  Boolean    | Specifies whether empty rows can be written. |\n| map              |     N       |  Function   | Custom Array.prototype.map() callback function for processing row values. |\n| sheetName        |     N       |  String     | Specify worksheet name. |\n| sheetId          |     N       |  Number     | Specify worksheet ID. |\n| formatterOptions |     N       |  Object     | [formatterOptions options](https://c2fo.github.io/fast-csv/docs/formatting/options/) @fast-csv/format module to write csv data. |\n\n```javascript\n\n// write to a file\nconst workbook = createAndFillWorkbook();\nawait workbook.csv.writeFile(filename);\n\n// write to a stream\n// Be careful that you need to provide sheetName or\n// sheetId for correct import to csv.\nawait workbook.csv.write(stream, { sheetName: 'Page name' });\n\n// write to a file with European Date-Times\nconst workbook = new Excel.Workbook();\nconst options = {\n  dateFormat: 'DD/MM/YYYY HH:mm:ss',\n  dateUTC: true, // use utc when rendering dates\n};\nawait workbook.csv.writeFile(filename, options);\n\n\n// write to a file with custom value formatting\nconst workbook = new Excel.Workbook();\nconst options = {\n  map(value, index) {\n    switch(index) {\n      case 0:\n        // column 1 is string\n        return value;\n      case 1:\n        // column 2 is a date\n        return dayjs(value).format('YYYY-MM-DD');\n      case 2:\n        // column 3 is a formula, write just the result\n        return value.result;\n      default:\n        // the rest are numbers\n        return value;\n    }\n  },\n  // https://c2fo.github.io/fast-csv/docs/formatting/options\n  formatterOptions: {\n    delimiter: '\\t',\n    quote: false,\n  },\n};\nawait workbook.csv.writeFile(filename, options);\n\n// write to a new buffer\nconst buffer = await workbook.csv.writeBuffer();\n```\n\nThe CSV parser uses [fast-csv](https://www.npmjs.com/package/fast-csv) to write the CSV file.\n The formatterOptions in the options passed to the above write function will be passed to the @fast-csv/format module to write csv data.\n Please refer to the fast-csv README.md for details.\n\nDates are formatted using the npm module [dayjs](https://www.npmjs.com/package/dayjs).\n If no dateFormat is supplied, dayjs.ISO_8601 is used.\n When writing a CSV you can supply the boolean dateUTC as true to have ExcelJS parse the date without automatically\n converting the timezone using `dayjs.utc()`.\n\n### Streaming I/O[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\nThe File I/O documented above requires that an entire workbook is built up in memory before the file can be written.\n While convenient, it can limit the size of the document due to the amount of memory required.\n\nA streaming writer (or reader) processes the workbook or worksheet data as it is generated,\n converting it into file form as it goes. Typically this is much more efficient on memory as the final\n memory footprint and even intermediate memory footprints are much more compact than with the document version,\n especially when you consider that the row and cell objects are disposed once they are committed.\n\nThe interface to the streaming workbook and worksheet is almost the same as the document versions with a few minor practical differences:\n\n* Once a worksheet is added to a workbook, it cannot be removed.\n* Once a row is committed, it is no longer accessible since it will have been dropped from the worksheet.\n* unMergeCells() is not supported.\n\nNote that it is possible to build the entire workbook without committing any rows.\n When the workbook is committed, all added worksheets (including all uncommitted rows) will be automatically committed.\n However in this case, little will have been gained over the Document version.\n\n#### Streaming XLSX[⬆](#contents)\u003c!-- Link generated with jump2header --\u003e\n\n##### Streaming XLSX Writer(#contents)\u003c!-- Link generated with jump2header --\u003e\n\nThe streaming XLSX workbook writer is available in the ExcelJS.stream.xlsx namespace.\n\nThe constructor takes an optional options object with the following fields:\n\n| Field            | Description |\n| ---------------- | ----------- |\n| stream           | Specifies a writable stream to write the XLSX workbook to. |\n| filename         | If stream not specified, this field specifies the path to a file to write the XLSX workbook to. |\n| useSharedStrings | Specifies whether to use shared strings in the workbook. Default is `false`. |\n| useStyles        | Specifies whether to add style information to the workbook. Styles can add some performance overhead. Default is `false`. |\n| zip              | [Zip options](https://www.archiverjs.com/global.html#ZipOptions) that ExcelJS internally passes to [Archiver](https://github.com/archiverjs/node-archiver). Default is `undefined`. |\n\nIf neither stream nor filename is specified in the options, the workbook writer will create a StreamBuf object\n that will store the contents of the XLSX workbook in memory.\n This StreamBuf object, which can be accessed via the property workbook.stream, can be used to either\n access the bytes directly by stream.read() or to pipe the contents to another stream.\n\n```javascript\n// construct a streaming XLSX workbook writer with styles and shared strings\nconst options = {\n  filename: './streamed-workbook.xlsx',\n  useStyles: true,\n  useSharedStrings: true\n};\nconst workbook = new Excel.stream.xlsx.WorkbookWriter(options);\n```\n\nIn general, the interface to the streaming XLSX writer is the same as the Document workbook (and worksheets)\n described above, in fact the row, cell and style objects are the same.\n\nHowever there are some differences...\n\n**Construction**\n\nAs seen above, the WorkbookWriter will typically require the output stream or file to be specified in the constructor.\n\n**Committing Data**\n\nWhen a worksheet row is ready, it should be committed so that the row object and contents can be freed.\n Typically this would be done as each row is added...\n\n```javascript\nworksheet.addRow({\n   id: i,\n   name: theName,\n   etc: someOtherDetail\n}).commit();\n```\n\nThe reason the WorksheetWriter does not commit rows as they are added is to allow cells to be merged across rows:\n\n```javascript\nworksheet.mergeCells('A1:B2');\nworksheet.getCell('A1').value = 'I am merged';\nworksheet.getCell('C1').value = 'I am not';\nworksheet.getCell('C2').value = 'Neither am I';\nworksheet.getRow(2).commit(); // now rows 1 and two are committed.\n```\n\nAs each worksheet is completed, it must also be committed:\n\n```javascript\n// Finished adding data. Commit the worksheet\nworksheet.commit();\n```\n\nTo complete the XLSX document, the workbook must be committed. If any worksheet in a workbook are uncommitted,\n they will be committed automatically as part of the workbook commit.\n\n```javascript\n// Finished the workbook.\nawait workbook.commit();\n// ... the stream has been written\n```\n\n##### Streaming XLSX Reader(#contents)\u003c!-- Link generated with jump2header --\u003e\n\nThe streaming XLSX workbook reader is available in the ExcelJS.stream.xlsx namespace.\n\nThe constructor takes a required input argument and an optional options argument:\n\n| Argument              | Description |\n| --------------------- | ----------- |\n| input (required)      | Specifies the name of the file or the readable stream from which to read ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexceljs%2Fexceljs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexceljs%2Fexceljs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexceljs%2Fexceljs/lists"}