[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-3318":3},{"id":4,"name":5,"fullName":6,"owner":5,"repo":5,"description":7,"homepage":8,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":9,"rankLanguage":9,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":9,"pushedAt":9,"updatedAt":35,"readmeContent":36,"aiSummary":37,"trendingCount":15,"starSnapshotCount":15,"syncStatus":16,"lastSyncTime":38,"discoverSource":39},3318,"exceljs","exceljs\u002Fexceljs","Excel Workbook Manager","",null,"JavaScript",15350,1995,180,655,0,2,9,65,11,44.9,"MIT License",false,"master",[25,5,26,27,28,29,30,31,32,33,34],"csv","hacktoberfest","streaming-workbook","workbook","workbook-writer","worksheet","xlsx","xlsx-workbook","xlsxreader","xlsxwriter","2026-06-12 02:00:48","# ExcelJS\n\n[![Build Status](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Factions\u002Fworkflows\u002Ftests.yml\u002Fbadge.svg?branch=master&event=push)](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Factions\u002Fworkflows\u002Ftests.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:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2551). \u003Cbr\u002F> Many thanks to Protobi and \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fmikez\">Michael\u003C\u002Fa> for this contribution!\n* Merged [fix: styles rendering in case when \"numFmt\" is present in conditional formatting rules (resolves #1814) #1815](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F1815). \u003Cbr\u002F> Many thanks to [@andreykrupskii](https:\u002F\u002Fgithub.com\u002Fandreykrupskii) for this contribution!\n* Merged [inlineStr cell type support #1575 #1576](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F1576). \u003Cbr\u002F> Many thanks to [@drdmitry](https:\u002F\u002Fgithub.com\u002Fdrdmitry) for this contribution!\n* Merged [Fix parsing of boolean attributes #1849](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F1849). \u003Cbr\u002F> Many thanks to [@bno1](https:\u002F\u002Fgithub.com\u002Fbno1) for this contribution!\n* Merged [add optional custom auto-filter to table #1670](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F1670). \u003Cbr\u002F> Many thanks to [@thambley](https:\u002F\u002Fgithub.com\u002Fthambley) for this contribution!\n* Merged [Deep copy inherited style #1850](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F1850). \u003Cbr\u002F> Many thanks to [@ikzhr](https:\u002F\u002Fgithub.com\u002Fikzhr) for this contribution!\n* Merged [Upgrade actions\u002Fcache and actions\u002Fsetup-node #1846](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F1846). \u003Cbr\u002F> Many thanks to [@cclauss](https:\u002F\u002Fgithub.com\u002Fcclauss) for this contribution!\n* Merged [Check object keys in isEqual #1831](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F1831). \u003Cbr\u002F> Many thanks to [@bno1](https:\u002F\u002Fgithub.com\u002Fbno1) for this contribution!\n* Merged [Add v17 to testing workflow #1856](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F1856). \u003Cbr\u002F> Many thanks to [@Siemienik](https:\u002F\u002Fgithub.com\u002FSiemienik) 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:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F1895). \u003Cbr\u002F> Many thanks to [@ValerioSevilla](https:\u002F\u002Fgithub.com\u002FValerioSevilla) for this contribution!\n* Merged [Update README.md #1677](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F1677). \u003Cbr\u002F> Many thanks to [@xjrcode](https:\u002F\u002Fgithub.com\u002Fxjrcode) for this contribution!\n* Merged [(docs): set prototype of RegExp correctly. #1700](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F1700). \u003Cbr\u002F> Many thanks to [@joeldenning](https:\u002F\u002Fgithub.com\u002Fjoeldenning) for this contribution!\n* Merged [Added timeouts to github actions #1733](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F1733). \u003Cbr\u002F> Many thanks to [@alexbjorlig](https:\u002F\u002Fgithub.com\u002Falexbjorlig) for this contribution!\n* Merged [fix issue 1676 #1701](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F1701). \u003Cbr\u002F> Many thanks to [@skypesky](https:\u002F\u002Fgithub.com\u002Fskypesky) for this contribution!\n* Merged [ExcelJS\u002FExcelJS#2237 : Update CI Tests, Drop support for Node v8  #2242](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2242). \u003Cbr\u002F> Many thanks to [@Siemienik](https:\u002F\u002Fgithub.com\u002FSiemienik) for this contribution!\n* Merged [Fix types for getWorksheet() #2223](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2223). \u003Cbr\u002F> Many thanks to [@hfhchan-plb](https:\u002F\u002Fgithub.com\u002Fhfhchan-plb) for this contribution!\n* Merged [add characters cannot be used for worksheet name #2126](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2126). \u003Cbr\u002F> Many thanks to [@tkm-kj](https:\u002F\u002Fgithub.com\u002Ftkm-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:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F1756). \u003Cbr\u002F> Many thanks to [@pauliusg](https:\u002F\u002Fgithub.com\u002Fpauliusg) for this contribution!\n* Merged [README.md to have correct link for Streaming XLSX #2186](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2186). \u003Cbr\u002F> Many thanks to [@wulfsolter](https:\u002F\u002Fgithub.com\u002Fwulfsolter) for this contribution!\n* Merged [Added a polyfill of promise.finally to support lower versions of Firefox. #1982](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F1982). \u003Cbr\u002F> Many thanks to [@DemoJj](https:\u002F\u002Fgithub.com\u002FDemoJj) for this contribution!\n* Merged [Fix read this.worksheet before assign it #1934](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F1934). \u003Cbr\u002F> Many thanks to [@ZyqGitHub1](https:\u002F\u002Fgithub.com\u002FZyqGitHub1) for this contribution!\n* Merged [chore: upgrade jszip to ^3.10.1 #2211](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2211). \u003Cbr\u002F> Many thanks to [@jarrod-cocoon](https:\u002F\u002Fgithub.com\u002Fjarrod-cocoon) for this contribution!\n* Merged [fixed spelling error in README.md file #2208](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2208). \u003Cbr\u002F> Many thanks to [@HugoP27](https:\u002F\u002Fgithub.com\u002FHugoP27) for this contribution!\n* Merged [fix: Fix xlsx.writeFile() not catching error when error occurs #2244](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2244). \u003Cbr\u002F> Many thanks to [@zurmokeeper](https:\u002F\u002Fgithub.com\u002Fzurmokeeper) for this contribution!\n* Merged [Improve worksheets' naming validation logic. #2257](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2257). \u003Cbr\u002F> Many thanks to [@Siemienik](https:\u002F\u002Fgithub.com\u002FSiemienik) for this contribution!\n* Merged [fix issue 2125 - spliceRows remove last row #2140](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2140). \u003Cbr\u002F> Many thanks to [@babu-ch](https:\u002F\u002Fgithub.com\u002Fbabu-ch) for this contribution!\n* Merged [fix: fix the loss of column attributes due to incorrect column order #2222](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2222). \u003Cbr\u002F> Many thanks to [@cpaiyueyue](https:\u002F\u002Fgithub.com\u002Fcpaiyueyue) for this contribution!\n* Merged [Fix: Sheet Properties Types #2327](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2327). \u003Cbr\u002F> Many thanks to [@albeniraouf](https:\u002F\u002Fgithub.com\u002Falbeniraouf) for this contribution!\n* Merged [Use node 18 LTS for tsc, and benchmark. Add node 20. to test matrix. … #2354](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2354). \u003Cbr\u002F> Many thanks to [@Siemienik](https:\u002F\u002Fgithub.com\u002FSiemienik) for this contribution!\n* Merged [Add missing tooltip attribute to CellHyperlinkValue index.d.ts #2350](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2350). \u003Cbr\u002F> Many thanks to [@NiklasPor](https:\u002F\u002Fgithub.com\u002FNiklasPor) for this contribution!\n* Merged [Increase resilience to generating large workbooks #2320](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2320). \u003Cbr\u002F> Many thanks to [@hfhchan-plb](https:\u002F\u002Fgithub.com\u002Fhfhchan-plb) for this contribution!\n* Merged [repair all 'c2fo.io' links ('c2fo.github.io') #2324](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2324). \u003Cbr\u002F> Many thanks to [@justintunev7](https:\u002F\u002Fgithub.com\u002Fjustintunev7) for this contribution!\n* Merged [fix: fix type definitions about last column, formula values and protection #2309](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2309). \u003Cbr\u002F> Many thanks to [@gltjk](https:\u002F\u002Fgithub.com\u002Fgltjk) for this contribution!\n* Merged [fix: add spinCount field for WorksheetProtection type #2284](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2284). \u003Cbr\u002F> Many thanks to [@damingerdai](https:\u002F\u002Fgithub.com\u002Fdamingerdai) for this contribution!\n* Merged [Add type definition for WorksheetModel.merges #2281](https:\u002F\u002Fgithub.com\u002Fexceljs\u002Fexceljs\u002Fpull\u002F2281). \u003Cbr\u002F> Many thanks to [@ytjmt](https:\u002F\u002Fgithub.com\u002Fytjmt) 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:\u002F\u002Fdiscordapp.com\u002Fapi\u002Fguilds\u002F976854442009825321\u002Fwidget.png?style=banner2)](https:\u002F\u002Fdiscord.gg\u002Fsiema)\n\n# Contents\n\n\u003Cul>\n  \u003Cli>\u003Ca href=\"#importing\">Importing\u003C\u002Fa>\u003C\u002Fli>\n  \u003Cli>\n    \u003Ca href=\"#interface\">Interface\u003C\u002Fa>\n    \u003Cul>\n      \u003Cli>\u003Ca href=\"#create-a-workbook\">Create a Workbook\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#set-workbook-properties\">Set Workbook Properties\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#workbook-views\">Workbook Views\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#add-a-worksheet\">Add a Worksheet\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#remove-a-worksheet\">Remove a Worksheet\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#access-worksheets\">Access Worksheets\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#worksheet-state\">Worksheet State\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#worksheet-properties\">Worksheet Properties\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#page-setup\">Page Setup\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#headers-and-footers\">Headers and Footers\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\n        \u003Ca href=\"#worksheet-views\">Worksheet Views\u003C\u002Fa>\n        \u003Cul>\n          \u003Cli>\u003Ca href=\"#frozen-views\">Frozen Views\u003C\u002Fa>\u003C\u002Fli>\n          \u003Cli>\u003Ca href=\"#split-views\">Split Views\u003C\u002Fa>\u003C\u002Fli>\n        \u003C\u002Ful>\n      \u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#auto-filters\">Auto Filters\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#columns\">Columns\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#rows\">Rows\u003C\u002Fa>\n        \u003Cul>\n          \u003Cli>\u003Ca href=\"#add-rows\">Add Rows\u003C\u002Fa>\u003C\u002Fli>\n          \u003Cli>\u003Ca href=\"#handling-individual-cells\">Handling Individual Cells\u003C\u002Fa>\u003C\u002Fli>\n          \u003Cli>\u003Ca href=\"#merged-cells\">Merged Cells\u003C\u002Fa>\u003C\u002Fli>\n          \u003Cli>\u003Ca href=\"#insert-rows\">Insert Rows\u003C\u002Fa>\u003C\u002Fli>\n          \u003Cli>\u003Ca href=\"#splice\">Splice\u003C\u002Fa>\u003C\u002Fli>\n          \u003Cli>\u003Ca href=\"#duplicate-a-row\">Duplicate Row\u003C\u002Fa>\u003C\u002Fli>\n        \u003C\u002Ful>\n      \u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#defined-names\">Defined Names\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#data-validations\">Data Validations\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#cell-comments\">Cell Comments\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#tables\">Tables\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#styles\">Styles\u003C\u002Fa>\n        \u003Cul>\n          \u003Cli>\u003Ca href=\"#number-formats\">Number Formats\u003C\u002Fa>\u003C\u002Fli>\n          \u003Cli>\u003Ca href=\"#fonts\">Fonts\u003C\u002Fa>\u003C\u002Fli>\n          \u003Cli>\u003Ca href=\"#alignment\">Alignment\u003C\u002Fa>\u003C\u002Fli>\n          \u003Cli>\u003Ca href=\"#borders\">Borders\u003C\u002Fa>\u003C\u002Fli>\n          \u003Cli>\u003Ca href=\"#fills\">Fills\u003C\u002Fa>\u003C\u002Fli>\n          \u003Cli>\u003Ca href=\"#rich-text\">Rich Text\u003C\u002Fa>\u003C\u002Fli>\n        \u003C\u002Ful>\n      \u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#conditional-formatting\">Conditional Formatting\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#outline-levels\">Outline Levels\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#images\">Images\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#sheet-protection\">Sheet Protection\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#file-io\">File I\u002FO\u003C\u002Fa>\n        \u003Cul>\n          \u003Cli>\u003Ca href=\"#xlsx\">XLSX\u003C\u002Fa>\n            \u003Cul>\n              \u003Cli>\u003Ca href=\"#reading-xlsx\">Reading XLSX\u003C\u002Fa>\u003C\u002Fli>\n              \u003Cli>\u003Ca href=\"#writing-xlsx\">Writing XLSX\u003C\u002Fa>\u003C\u002Fli>\n            \u003C\u002Ful>\n          \u003C\u002Fli>\n          \u003Cli>\u003Ca href=\"#csv\">CSV\u003C\u002Fa>\n            \u003Cul>\n              \u003Cli>\u003Ca href=\"#reading-csv\">Reading CSV\u003C\u002Fa>\u003C\u002Fli>\n              \u003Cli>\u003Ca href=\"#writing-csv\">Writing CSV\u003C\u002Fa>\u003C\u002Fli>\n            \u003C\u002Ful>\n          \u003C\u002Fli>\n          \u003Cli>\u003Ca href=\"#streaming-io\">Streaming I\u002FO\u003C\u002Fa>\n            \u003Cul>\n              \u003Cli>\u003Ca href=\"#streaming-xlsx\">Streaming XLSX\u003C\u002Fa>\u003C\u002Fli>\n            \u003C\u002Ful>\n          \u003C\u002Fli>\n        \u003C\u002Ful>\n      \u003C\u002Fli>\n    \u003C\u002Ful>\n  \u003C\u002Fli>\n  \u003Cli>\u003Ca href=\"#browser\">Browser\u003C\u002Fa>\u003C\u002Fli>\n  \u003Cli>\n    \u003Ca href=\"#value-types\">Value Types\u003C\u002Fa>\n    \u003Cul>\n      \u003Cli>\u003Ca href=\"#null-value\">Null Value\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#merge-cell\">Merge Cell\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#number-value\">Number Value\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#string-value\">String Value\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#date-value\">Date Value\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#hyperlink-value\">Hyperlink Value\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\n        \u003Ca href=\"#formula-value\">Formula Value\u003C\u002Fa>\n        \u003Cul>\n          \u003Cli>\u003Ca href=\"#shared-formula\">Shared Formula\u003C\u002Fa>\u003C\u002Fli>\n          \u003Cli>\u003Ca href=\"#formula-type\">Formula Type\u003C\u002Fa>\u003C\u002Fli>\n          \u003Cli>\u003Ca href=\"#array-formula\">Array Formula\u003C\u002Fa>\u003C\u002Fli>\n        \u003C\u002Ful>\n      \u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#rich-text-value\">Rich Text Value\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#boolean-value\">Boolean Value\u003C\u002Fa>\u003C\u002Fli>\n      \u003Cli>\u003Ca href=\"#error-value\">Error Value\u003C\u002Fa>\u003C\u002Fli>\n    \u003C\u002Ful>\n  \u003C\u002Fli>\n  \u003Cli>\u003Ca href=\"#config\">Config\u003C\u002Fa>\u003C\u002Fli>\n  \u003Cli>\u003Ca href=\"#known-issues\">Known Issues\u003C\u002Fa>\u003C\u002Fli>\n  \u003Cli>\u003Ca href=\"#release-history\">Release History\u003C\u002Fa>\u003C\u002Fli>\n\u003C\u002Ful>\n\n# Importing[⬆](#contents)\u003C!-- Link generated with jump2header -->\n\n```javascript\nconst ExcelJS = require('exceljs');\n```\n\n## ES5 Imports[⬆](#contents)\u003C!-- Link generated with jump2header -->\n\nTo use the ES5 transpiled code, for example for node.js versions older than 10, use the dist\u002Fes5 path.\n\n```javascript\nconst ExcelJS = require('exceljs\u002Fdist\u002Fes5');\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\u002F\u002F polyfills required by exceljs\nrequire('core-js\u002Fmodules\u002Fes.promise');\nrequire('core-js\u002Fmodules\u002Fes.string.includes');\nrequire('core-js\u002Fmodules\u002Fes.object.assign');\nrequire('core-js\u002Fmodules\u002Fes.object.keys');\nrequire('core-js\u002Fmodules\u002Fes.symbol');\nrequire('core-js\u002Fmodules\u002Fes.symbol.async-iterator');\nrequire('regenerator-runtime\u002Fruntime');\n\nconst ExcelJS = require('exceljs\u002Fdist\u002Fes5');\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\u002Fhelper-create-regexp-features-plugin\u002Flib\u002Futil');\n\nconst {RegExp} = global;\ntry {\n  new RegExp('a', 'u');\n} catch (err) {\n  global.RegExp = function(pattern, flags) {\n    if (flags && 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 -->\n\nExcelJS publishes two browserified bundles inside the dist\u002F folder:\n\nOne with implicit dependencies on core-js polyfills...\n```html\n\u003Cscript src=\"https:\u002F\u002Fcdnjs.cloudflare.com\u002Fajax\u002Flibs\u002Fbabel-polyfill\u002F6.26.0\u002Fpolyfill.js\">\u003C\u002Fscript>\n\u003Cscript src=\"exceljs.js\">\u003C\u002Fscript>\n```\n\nAnd one without...\n```html\n\u003Cscript src=\"--your-project's-pollyfills-here--\">\u003C\u002Fscript>\n\u003Cscript src=\"exceljs.bare.js\">\u003C\u002Fscript>\n```\n\n\n# Interface[⬆](#contents)\u003C!-- Link generated with jump2header -->\n\n## Create a Workbook[⬆](#contents)\u003C!-- Link generated with jump2header -->\n\n```javascript\nconst workbook = new ExcelJS.Workbook();\n```\n\n## Set Workbook Properties[⬆](#contents)\u003C!-- Link generated with jump2header -->\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\u002F\u002F Set workbook dates to 1904 date system\nworkbook.properties.date1904 = true;\n```\n\n## Set Calculation Properties[⬆](#contents)\u003C!-- Link generated with jump2header -->\n\n```javascript\n\u002F\u002F Force workbook calculation on load\nworkbook.calcProperties.fullCalcOnLoad = true;\n```\n\n## Workbook Views[⬆](#contents)\u003C!-- Link generated with jump2header -->\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 -->\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\u002F\u002F create a sheet with red tab colour\nconst sheet = workbook.addWorksheet('My Sheet', {properties:{tabColor:{argb:'FFC0000'}}});\n\n\u002F\u002F create a sheet where the grid lines are hidden\nconst sheet = workbook.addWorksheet('My Sheet', {views: [{showGridLines: false}]});\n\n\u002F\u002F 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\u002F\u002F Create worksheets with headers and footers\nconst sheet = workbook.addWorksheet('My Sheet', {\n  headerFooter:{firstHeader: \"Hello Exceljs\", firstFooter: \"Hello World\"}\n});\n\n\u002F\u002F 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 -->\n\nUse the worksheet `id` to remove the sheet from workbook.\n\nFor Example:\n\n```javascript\n\u002F\u002F Create a worksheet\nconst sheet = workbook.addWorksheet('My Sheet');\n\n\u002F\u002F Remove the worksheet using worksheet id\nworkbook.removeWorksheet(sheet.id)\n```\n\n## Access Worksheets[⬆](#contents)\u003C!-- Link generated with jump2header -->\n```javascript\n\u002F\u002F Iterate over all sheets\n\u002F\u002F Note: workbook.worksheets.forEach will still work but this is better\nworkbook.eachSheet(function(worksheet, sheetId) {\n  \u002F\u002F ...\n});\n\n\u002F\u002F fetch sheet by name\nconst worksheet = workbook.getWorksheet('My Sheet');\n\n\u002F\u002F fetch sheet by id\n\u002F\u002F INFO: Be careful when using it!\n\u002F\u002F It tries to access to `worksheet.id` field. Sometimes (really very often) workbook has worksheets with id not starting from 1.\n\u002F\u002F For instance It happens when any worksheet has been deleted.\n\u002F\u002F It's much more safety when you assume that ids are random. And stop to use this function.\n\u002F\u002F If you need to access all worksheets in a loop please look to the next example.\nconst worksheet = workbook.getWorksheet(1);\n\n\u002F\u002F access by `worksheets` array:\nworkbook.worksheets[0]; \u002F\u002Fthe 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 -->\n\n```javascript\n\u002F\u002F make worksheet visible\nworksheet.state = 'visible';\n\n\u002F\u002F make worksheet hidden\nworksheet.state = 'hidden';\n\n\u002F\u002F make worksheet hidden from 'hide\u002Funhide' dialog\nworksheet.state = 'veryHidden';\n```\n\n## Worksheet Properties[⬆](#contents)\u003C!-- Link generated with jump2header -->\n\nWorksheets support a property bucket to allow control over some features of the worksheet.\n\n```javascript\n\u002F\u002F create new sheet with properties\nconst worksheet = workbook.addWorksheet('sheet', {properties:{tabColor:{argb:'FF00FF00'}}});\n\n\u002F\u002F create a new sheet writer with properties\nconst worksheetWriter = workbookWriter.addWorksheet('sheet', {properties:{outlineLevelCol:1}});\n\n\u002F\u002F 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 -->\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 -->\n\nAll properties that can affect the printing of a sheet are held in a pageSetup object on the sheet.\n\n```javascript\n\u002F\u002F create new sheet with pageSetup settings for A4 - landscape\nconst worksheet =  workbook.addWorksheet('sheet', {\n  pageSetup:{paperSize: 9, orientation:'landscape'}\n});\n\n\u002F\u002F 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\u002F\u002F 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\u002F\u002F Set Print Area for a sheet\nworksheet.pageSetup.printArea = 'A1:G20';\n\n\u002F\u002F Set multiple Print Areas by separating print areas with '&&'\nworksheet.pageSetup.printArea = 'A1:G10&&A11:G20';\n\n\u002F\u002F Repeat specific rows on every printed page\nworksheet.pageSetup.printTitlesRow = '1:3';\n\n\u002F\u002F 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 -->\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\u002F\u002F Create worksheets with headers and footers\nvar sheet = workbook.addWorksheet('sheet', {\n  headerFooter:{firstHeader: \"Hello Exceljs\", firstFooter: \"Hello World\"}\n});\n\u002F\u002F Create worksheets with headers and footers\nvar worksheetWriter = workbookWriter.addWorksheet('sheet', {\n  headerFooter:{firstHeader: \"Hello Exceljs\", firstFooter: \"Hello World\"}\n});\n\u002F\u002F Set footer (default centered), result: \"Page 2 of 16\"\nworksheet.headerFooter.oddFooter = \"Page &P of &N\";\n\n\u002F\u002F Set the footer (default centered) to bold, resulting in: \"Page 2 of 16\"\nworksheet.headerFooter.oddFooter = \"Page &P of &N\";\n\n\u002F\u002F Set the left footer to 18px and italicize. Result: \"Page 2 of 16\"\nworksheet.headerFooter.oddFooter = \"&LPage &P of &N\";\n\n\u002F\u002F Set the middle header to gray Aril, the result: \"52 exceljs\"\nworksheet.headerFooter.oddHeader = \"&C&KCCCCCC&\\\"Aril\\\"52 exceljs\";\n\n\u002F\u002F 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 = \"&Lexceljs&C&F&RPage &P\";\n\n\u002F\u002F Add different header & 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\u002Ffooters for first page are different from the other pages |\n| differentOddEven  | false     | Set the value of differentOddEven as true, which indicates that headers\u002Ffooters 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| &L           | Set position to the left |\n| &C           | Set position to the center |\n| &R           | Set position to the right |\n| &P           | The current page number |\n| &N           | The total number of pages |\n| &D           | The current date |\n| &T           | The current time |\n| &G           | A picture |\n| &A           | The worksheet name |\n| &F           | The file name |\n| &B           | Make text bold |\n| &I           | Italicize text |\n| &U           | Underline text |\n| &\"font name\" | font name, for example &\"Aril\" |\n| &font size   | font size, for example 12 |\n| &KHEXCode    | font color, for example &KCCCCCC |\n\n## Worksheet Views[⬆](#contents)\u003C!-- Link generated with jump2header -->\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 -->\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 -->\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 -->\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\u002F\u002F Set an auto filter from A1 to C1\nworksheet.autoFilter = {\n  from: 'A1',\n  to: 'C1',\n}\n\n\u002F\u002F Set an auto filter from the cell in row 3 and column 1\n\u002F\u002F 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\u002F\u002F Set an auto filter from D3 to the\n\u002F\u002F 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 -->\n\n```javascript\n\u002F\u002F Add column headers and define column keys and widths\n\u002F\u002F Note: these column structures are a workbook-building convenience only,\n\u002F\u002F 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\u002F\u002F 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\u002F\u002F set column properties\n\n\u002F\u002F Note: will overwrite cell value C1\ndobCol.header = 'Date of Birth';\n\n\u002F\u002F Note: this will overwrite cell values C1:C2\ndobCol.header = ['Date of Birth', 'A.K.A. D.O.B.'];\n\n\u002F\u002F from this point on, this column will be indexed by 'dob' and not 'DOB'\ndobCol.key = 'dob';\n\ndobCol.width = 15;\n\n\u002F\u002F Hide the column if you'd like\ndobCol.hidden = true;\n\n\u002F\u002F set an outline level for columns\nworksheet.getColumn(4).outlineLevel = 0;\nworksheet.getColumn(5).outlineLevel = 1;\n\n\u002F\u002F 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\u002F\u002F iterate over all current cells in this column\ndobCol.eachCell(function(cell, rowNumber) {\n  \u002F\u002F ...\n});\n\n\u002F\u002F iterate over all current cells in this column including empty cells\ndobCol.eachCell({ includeEmpty: true }, function(cell, rowNumber) {\n  \u002F\u002F ...\n});\n\n\u002F\u002F add a column of new values\nworksheet.getColumn(6).values = [1,2,3,4,5];\n\n\u002F\u002F add a sparse column of values\nworksheet.getColumn(7).values = [,,2,3,,5,,7,,,,11];\n\n\u002F\u002F cut one or more columns (columns to the right are shifted left)\n\u002F\u002F If column properties have been defined, they will be cut or moved accordingly\n\u002F\u002F Known Issue: If a splice causes any merged cells to move, the results may be unpredictable\nworksheet.spliceColumns(3,2);\n\n\u002F\u002F remove one column and insert two more.\n\u002F\u002F Note: columns 4 and above will be shifted right by 1 column.\n\u002F\u002F Also: If the worksheet has more rows than values in the column inserts,\n\u002F\u002F  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 -->\n\n```javascript\n\u002F\u002F Get a row object. If it doesn't already exist, a new empty one will be returned\nconst row = worksheet.getRow(5);\n\n\u002F\u002F Get multiple row objects. If it doesn't already exist, new empty ones will be returned\nconst rows = worksheet.getRows(5, 2); \u002F\u002F start, length (>0, else undefined is returned)\n\n\u002F\u002F Get the last editable row in a worksheet (or undefined if there are none)\nconst row = worksheet.lastRow;\n\n\u002F\u002F Set a specific row height\nrow.height = 42.5;\n\n\u002F\u002F make row hidden\nrow.hidden = true;\n\n\u002F\u002F set an outline level for rows\nworksheet.getRow(4).outlineLevel = 0;\nworksheet.getRow(5).outlineLevel = 1;\n\n\u002F\u002F 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; \u002F\u002F A5's value set to 5\nrow.getCell('name').value = 'Zeb'; \u002F\u002F B5's value set to 'Zeb' - assuming column 2 is still keyed by name\nrow.getCell('C').value = new Date(); \u002F\u002F C5's value set to now\n\n\u002F\u002F Get a row as a sparse array\n\u002F\u002F Note: interface change: worksheet.getRow(4) ==> worksheet.getRow(4).values\nrow = worksheet.getRow(4).values;\nexpect(row[5]).toEqual('Kyle');\n\n\u002F\u002F 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\u002F\u002F 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\u002F\u002F assign row values by object, using column keys\nrow.values = {\n  id: 13,\n  name: 'Thing 1',\n  dob: new Date()\n};\n\n\u002F\u002F Insert a page break below the row\nrow.addPageBreak();\n\n\u002F\u002F 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\u002F\u002F 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\u002F\u002F Iterate over all non-null cells in a row\nrow.eachCell(function(cell, colNumber) {\n  console.log('Cell ' + colNumber + ' = ' + cell.value);\n});\n\n\u002F\u002F 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\u002F\u002F Commit a completed row to stream\nrow.commit();\n\n\u002F\u002F row metrics\nconst rowSize = row.cellCount;\nconst numValues = row.actualCellCount;\n```\n\n## Add Rows[⬆](#contents)\u003C!-- Link generated with jump2header -->\n\n```javascript\n\u002F\u002F 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\u002F\u002F Add a row by contiguous Array (assign to columns A, B & C)\nworksheet.addRow([3, 'Sam', new Date()]);\n\n\u002F\u002F Add a row by sparse Array (assign to columns A, E & I)\nconst rowValues = [];\nrowValues[1] = 4;\nrowValues[5] = 'Kyle';\nrowValues[9] = new Date();\nworksheet.addRow(rowValues);\n\n\u002F\u002F Add a row with inherited style\n\u002F\u002F This new row will have same style as last row\n\u002F\u002F And return as row object\nconst newRow = worksheet.addRow(rowValues, 'i');\n\n\u002F\u002F Add an array of rows\nconst rows = [\n  [5,'Bob',new Date()], \u002F\u002F row by array\n  {id:6, name: 'Barbara', dob: new Date()}\n];\n\u002F\u002F add new rows and return them as array of row objects\nconst newRows = worksheet.addRows(rows);\n\n\u002F\u002F Add an array of rows with inherited style\n\u002F\u002F These new rows will have same styles as last row\n\u002F\u002F and return them as array of row objects\nconst newRowsStyled = worksheet.addRows(rows, 'i');\n```\n| Parameter | Description | Default Value |\n| -------------- | ----------------- | -------- |\n| value\u002Fs    | The new row\u002Fs 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 -->\n\n```javascript\nconst cell = worksheet.getCell('C3');\n\n\u002F\u002F Modify\u002FAdd individual cell\ncell.value = new Date(1968, 5, 1);\n\n\u002F\u002F query a cell's type\nexpect(cell.type).toEqual(Excel.ValueType.Date);\n\n\u002F\u002F use string value of cell\nmyInput.value = cell.text;\n\n\u002F\u002F use html-safe string for rendering...\nconst html = '\u003Cdiv>' + cell.html + '\u003C\u002Fdiv>';\n\n```\n\n## Merged Cells[⬆](#contents)\u003C!-- Link generated with jump2header -->\n\n```javascript\n\u002F\u002F merge a range of cells\nworksheet.mergeCells('A4:B5');\n\n\u002F\u002F ... 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\u002F\u002F ... 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\u002F\u002F 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\u002F\u002F merge by top-left, bottom-right\nworksheet.mergeCells('K10', 'M12');\n\n\u002F\u002F 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 -->\n\n```javascript\ninsertRow(pos, value, style = 'n')\ninsertRows(pos, values, style = 'n')\n\n\u002F\u002F 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\u002F\u002F Insert a row by contiguous Array (assign to columns A, B & C)\nworksheet.insertRow(1, [3, 'Sam', new Date()]);\n\n\u002F\u002F Insert a row by sparse Array (assign to columns A, E & I)\nvar rowValues = [];\nrowValues[1] = 4;\nrowValues[5] = 'Kyle';\nrowValues[9] = new Date();\n\u002F\u002F insert new row and return as row object\nconst insertedRow = worksheet.insertRow(1, rowValues);\n\n\u002F\u002F Insert a row, with inherited style\n\u002F\u002F This new row will have same style as row on top of it\n\u002F\u002F And return as row object\nconst insertedRowInherited = worksheet.insertRow(1, rowValues, 'i');\n\n\u002F\u002F Insert a row, keeping original style\n\u002F\u002F This new row will have same style as it was previously\n\u002F\u002F And return as row object\nconst insertedRowOriginal = worksheet.insertRow(1, rowValues, 'o');\n\n\u002F\u002F 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()], \u002F\u002F row by array\n  {id:6, name: 'Barbara', dob: new Date()}\n];\n\u002F\u002F insert new rows and return them as array of row objects\nconst insertedRows = worksheet.insertRows(1, rows);\n\n\u002F\u002F Insert an array of rows, with inherited style\n\u002F\u002F These new rows will have same style as row on top of it\n\u002F\u002F And return them as array of row objects\nconst insertedRowsInherited = worksheet.insertRows(1, rows, 'i');\n\n\u002F\u002F Insert an array of rows, keeping original style\n\u002F\u002F 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\u002Fs    | The new row\u002Fs 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 -->\n\n```javascript\n\u002F\u002F Cut one or more rows (rows below are shifted up)\n\u002F\u002F Known Issue: If a splice causes any merged cells to move, the results may be unpredictable\nworksheet.spliceRows(4, 3);\n\n\u002F\u002F remove one row and insert two more.\n\u002F\u002F 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\u002F\u002F Cut one or more cells (cells to the right are shifted left)\n\u002F\u002F Note: this operation will not affect other rows\nrow.splice(3, 2);\n\n\u002F\u002F 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\u002Fcells to remove |  |\n| ...inserts            | New row\u002Fcell values to insert |  |\n\n## Duplicate a Row[⬆](#contents)\u003C!-- Link generated with jump2header -->\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\u002F\u002F This line will duplicate the row 'One' twice but it will replace rows 'Two' and 'Three'\n\u002F\u002F 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 -->\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\u002F\u002F 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\u002F\u002F 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\u002F\u002F 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 -->\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\u002F\u002F Specify list of valid values (One, Two, Three, Four).\n\u002F\u002F 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\u002F\u002F Specify list of valid values from a range.\n\u002F\u002F 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\u002F\u002F Specify Cell must be a whole number that is not 5.\n\u002F\u002F 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\u002F\u002F Specify Cell must be a decimal number between 1.5 and 7.\n\u002F\u002F 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\u002F\u002F 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\u002F\u002F 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 -->\n\nAdd old style comment to a cell\n\n```javascript\n\u002F\u002F plain text note\nworksheet.getCell('A1').note = 'Hello, ExcelJS!';\n\n\u002F\u002F 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 -->\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 -->\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 -->\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 -->\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 -->\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\u002F\u002F 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 -->\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 -->\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 -->\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 -->\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 -->\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 -->\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\u002F\u002F turn header row on\ntable.headerRow = true;\n\n\u002F\u002F turn totals row off\ntable.totalsRow = false;\n\n\u002F\u002F 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\u002F\u002F table top-left move to D4\ntable.ref = 'D4';\n\n\u002F\u002F 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\u002F\u002F remove first two rows\ntable.removeRows(0, 2);\n\n\u002F\u002F insert new rows at index 5\ntable.addRow([new Date('2019-08-05'), 5, 'Mid'], 5);\n\n\u002F\u002F append new row to bottom of table\ntable.addRow([new Date('2019-08-10'), 10, 'End']);\n\n\u002F\u002F 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\u002F\u002F remove second column\ntable.removeColumns(1, 1);\n\n\u002F\u002F 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\u002F\u002F 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\u002F\u002F Get Column Wrapper for second column\nconst column = table.getColumn(1);\n\n\u002F\u002F 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\u002F\u002F commit the table changes into the sheet\ntable.commit();\n```\n\n\n## Styles[⬆](#contents)\u003C!-- Link generated with jump2header -->\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\">numFmt\u003C\u002Fa>\n* \u003Ca href=\"#fonts\">font\u003C\u002Fa>\n* \u003Ca href=\"#alignment\">alignment\u003C\u002Fa>\n* \u003Ca href=\"#borders\">border\u003C\u002Fa>\n* \u003Ca href=\"#fills\">fill\u003C\u002Fa>\n\n```javascript\n\u002F\u002F assign a style to a cell\nws.getCell('A1').numFmt = '0.00%';\n\n\u002F\u002F 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\u002Fmm\u002Fyyyy' } }\n];\n\n\u002F\u002F Set Column 3 to Currency Format\nws.getColumn(3).numFmt = '\"£\"#,##0.00;[Red]\\-\"£\"#,##0.00';\n\n\u002F\u002F 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 -->\n\n```javascript\n\u002F\u002F display value as '1 3\u002F5'\nws.getCell('A1').value = 1.6;\nws.getCell('A1').numFmt = '# ?\u002F?';\n\n\u002F\u002F 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 -->\n\n```javascript\n\n\u002F\u002F 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\u002F\u002F 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\u002F\u002F for the vertical align\nws.getCell('A3').font = {\n  vertAlign: 'superscript'\n};\n\n\u002F\u002F note: the cell will store a reference to the font object assigned.\n\u002F\u002F 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; \u002F\u002F Cell A3 now has font size 20!\n\n\u002F\u002F Cells that share similar fonts may reference the same font object after\n\u002F\u002F 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>underline\u003C\u002Fu> style | true, false, 'none', 'single', 'double', 'singleAccounting', 'doubleAccounting' |\n| strike        | Font \u003Cstrike>strikethrough\u003C\u002Fstrike> | true, false |\n| outline       | Font outline | true, false |\n| vertAlign     | Vertical align | 'superscript', 'subscript'\n\n### Alignment[⬆](#contents)\u003C!-- Link generated with jump2header -->\n\n```javascript\n\u002F\u002F 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\u002F\u002F set cell to wrap-text\nws.getCell('D1').alignment = { wrapText: true };\n\n\u002F\u002F set cell indent to 1\nws.getCell('E1').alignment = { indent: 1 };\n\n\u002F\u002F 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 -->\n\n```javascript\n\u002F\u002F 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\u002F\u002F 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\u002F\u002F 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 -->\n\n```javascript\n\u002F\u002F fill A1 with red darkVertical stripes\nws.getCell('A1').fill = {\n  type: 'pattern',\n  pattern:'darkVertical',\n  fgColor:{argb:'FFFF0000'}\n};\n\n\u002F\u002F 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\u002F\u002F fill A3 with solid coral\nws.getCell('A3').fill = {\n  type: 'pattern',\n  pattern:'solid',\n  fgColor:{argb:'F08080'},\n};\n\n\u002F\u002F 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:","ExcelJS 是一个用于读取、操作和写入 XLSX 和 JSON 格式的电子表格数据及样式的 JavaScript 库。它支持多种功能，包括但不限于创建和编辑工作簿与工作表、处理样式、条件格式化、数据透视表以及流式处理大型文件等。该库基于对 Excel 文件的逆向工程开发而成，具有良好的兼容性和灵活性。适用于需要在 Node.js 或浏览器环境中进行电子表格数据处理的各种场景，如报表生成、数据分析、自动化测试等。","2026-06-11 02:53:31","top_language"]