{"_id":"@42technologies/xlsx","_rev":"3-0bddc1ba9aacc87dd423f7beeb580da5","name":"@42technologies/xlsx","dist-tags":{"latest":"0.7.10"},"versions":{"0.7.10":{"name":"@42technologies/xlsx","version":"0.7.10","author":{"name":"sheetjs"},"description":"Excel 2007+ spreadsheet (XLSB/XLSX/XLSM) parser and writer","keywords":["excel","xlsx","xlsb","xlsm","office","spreadsheet"],"bin":{"xlsx":"bin/xlsx.njs"},"main":"./xlsx","publishConfig":{"access":"public"},"dependencies":{"ssf":"~0.8.1","codepage":"~1.3.4","cfb":">=0.10.0","jszip":"2.4.0","crc-32":"","adler-32":"","commander":""},"devDependencies":{"mocha":"","xlsjs":"","uglify-js":"","jasmine-node":"x"},"repository":{"type":"git","url":"git://github.com/42technologies/js-xlsx.git"},"scripts":{"pretest":"git submodule init && git submodule update","test":"make test","test-jasmine":"jasmine-node --verbose tests/"},"config":{"blanket":{"pattern":"xlsx.js"}},"bugs":{"url":"https://github.com/SheetJS/js-xlsx/issues"},"license":"Apache-2.0","engines":{"node":">=0.8"},"gitHead":"19f3a6ae762640ee22d36710878f44e64afca884","homepage":"https://github.com/42technologies/js-xlsx#readme","_id":"@42technologies/xlsx@0.7.10","_nodeVersion":"15.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-kewMJHh4nUegnRD/U6zbrnLGV0YeV83xL9ArTTfv10zouuYd46C3YBckMGyGPtNiwosdk8wNwVP3mG3yIfiZIg==","shasum":"15d3f59d07ec5dfb15f39b3c1241c1fc554dcb9b","tarball":"https://registry.npmjs.org/@42technologies/xlsx/-/xlsx-0.7.10.tgz","fileCount":73,"unpackedSize":3502034,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhuhjSCRA9TVsSAnZWagAAyLMQAKPTraeZy6TKsGRHAN6N\n1vxv/1cDSU3xHTUS457Li9bPtT4TjkYWLQhahRLuldVUGWNFWiit0rUd12HX\nQOuWXKCwS7taHiSFZ9pUaTDTyHxNBr/usgX8qgWtl067Hnvh5O2TySKfdMbi\nTpCZUcFD7SChB0kNQE7vsIlLewBOXVBLqmMz8qiJuWo0CG/CBoPdQ7OQZOcL\no9EFu0rOZ08BjMNW8zrt14lkpmkDRXjxavUW4vJ2GZz0bLgClm7iALZVY2LF\nwC+FX1YTz6ns0LNnKayd8eGHXeRhJi3Z7MdFlQ58a0g614eYgCH7OvxzvvuP\nSKslYoimqhKzMyaDFNMydaVC72a3GQnPzlv8k6R6JXoH/kTdMkThfX6EPz/D\n30fY47NX7idgu51N7QZSxzjJboMqgsyNzt91m1dReACsWxDKAgVXKAHlQlZ9\n0CnHamMETCOEmFZUo5tHdbNxqxTrSmRVn22n4Zgr4C7QG36xSfw0yyBgeWm0\njVkrVVA3QrgIOffjKDUpG0hkVuToTmi15wFh4AXqkXMWDwmhz7jg50nXCwzz\nqyAkwFBJRa4xnkbqZAZDyOgVAYC/u4XuDbQK9xihEgH+C9/LbgZsQSJWWIDd\n9uq50+SKI/Egkj/J4CM1z919PevhHfpS+nyeo7xGoybqjHj0nJfi4PJRA0ii\nhLMG\r\n=xUXP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDo8hJ9uVqpaFd1yCS2mIUb/Z79pokUPCiVMKbS9UTM+AiEAtk/N+v7lfz+v+opokrdYfQwxbVSh8UYHea4/NBHro/g="}]},"_npmUser":{"name":"surjikal","email":"npm@surj.email"},"directories":{},"maintainers":[{"name":"surjikal","email":"npm@surj.email"},{"name":"nickporter42","email":"nick@42technologies.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xlsx_0.7.10_1635289147466_0.7139521833875153"},"_hasShrinkwrap":false}},"time":{"created":"2021-10-26T22:59:07.414Z","0.7.10":"2021-10-26T22:59:07.746Z","modified":"2022-04-04T10:45:50.404Z"},"maintainers":[{"email":"lars.butzmann@gmail.com","name":"lbutzmann"},{"email":"npm@surj.email","name":"surjikal"},{"email":"nick@42technologies.com","name":"nickporter42"}],"description":"Excel 2007+ spreadsheet (XLSB/XLSX/XLSM) parser and writer","homepage":"https://github.com/42technologies/js-xlsx#readme","keywords":["excel","xlsx","xlsb","xlsm","office","spreadsheet"],"repository":{"type":"git","url":"git://github.com/42technologies/js-xlsx.git"},"author":{"name":"sheetjs"},"bugs":{"url":"https://github.com/SheetJS/js-xlsx/issues"},"license":"Apache-2.0","readme":"# xlsx\n\nParser and writer for Excel 2007+ (XLSX/XLSM/XLSB) files.  Pure-JS cleanroom\nimplementation from the Office Open XML spec, [MS-XLSB], and related documents.\n\n## Installation\n\nIn [nodejs](https://www.npmjs.org/package/xlsx):\n\n    npm install xlsx\n\nIn the browser:\n\n    <!-- This is the only file you need (includes xlsx.js and jszip) -->\n    <script lang=\"javascript\" src=\"dist/xlsx.core.min.js\"></script>\n\nIn [bower](http://bower.io/search/?q=js-xlsx):\n\n    bower install js-xlsx\n\nCDNjs automatically pulls the latest version and makes all versions available at\n<http://cdnjs.com/libraries/xlsx>\n\nOlder versions of this README recommended a more explicit approach:\n\n    <!-- JSZip must be included before xlsx.js -->\n    <script lang=\"javascript\" src=\"/path/to/jszip.js\"></script>\n    <script lang=\"javascript\" src=\"/path/to/xlsx.js\"></script>\n\n## Optional Modules\n\nThe nodejs version automatically requires modules for additional features.  Some\nof these modules are rather large in size and are only needed in special\ncircumstances, so they do not ship with the core.  For browser use, they must\nbe included directly:\n\n    <!-- international support from https://github.com/sheetjs/js-codepage -->\n    <script src=\"dist/cpexcel.js\"></script>\n\nAn appropriate version for each dependency is included in the dist/ directory.\n\nThe complete single-file version is generated at `dist/xlsx.full.min.js`\n\n## ECMAScript 5 compatibility\n\nSince xlsx.js uses ES5 functions like `Array#forEach`, older browsers require\n[Polyfills](http://git.io/QVh77g).  This repo and the gh-pages branch include\n[a shim](https://github.com/SheetJS/js-xlsx/blob/master/shim.js)\n\nTo use the shim, add the shim before the script tag that loads xlsx.js:\n\n    <script type=\"text/javascript\" src=\"/path/to/shim.js\"></script>\n\n## Parsing Workbooks\n\nFor parsing, the first step is to read the file.\n\n- nodejs:\n\n```\nif(typeof require !== 'undefined') XLSX = require('xlsx');\nvar workbook = XLSX.readFile('test.xlsx');\n/* DO SOMETHING WITH workbook HERE */\n```\n\n- ajax (for a more complete example that works in older versions of IE, check the\n  demo at <http://oss.sheetjs.com/js-xlsx/ajax.html>):\n\n```\n/* set up XMLHttpRequest */\nvar url = \"test_files/formula_stress_test_ajax.xlsx\";\nvar oReq = new XMLHttpRequest();\noReq.open(\"GET\", url, true);\noReq.responseType = \"arraybuffer\";\n\noReq.onload = function(e) {\n  var arraybuffer = oReq.response;\n\n  /* convert data to binary string */\n  var data = new Uint8Array(arraybuffer);\n  var arr = new Array();\n  for(var i = 0; i != data.length; ++i) arr[i] = String.fromCharCode(data[i]);\n  var bstr = arr.join(\"\");\n\n  /* Call XLSX */\n  var workbook = XLSX.read(bstr, {type:\"binary\"});\n\n  /* DO SOMETHING WITH workbook HERE */\n}\n\noReq.send();\n```\n\n- HTML5 drag-and-drop using readAsBinaryString:\n\n```\n/* set up drag-and-drop event */\nfunction handleDrop(e) {\n  e.stopPropagation();\n  e.preventDefault();\n  var files = e.dataTransfer.files;\n  var i,f;\n  for (i = 0, f = files[i]; i != files.length; ++i) {\n    var reader = new FileReader();\n    var name = f.name;\n    reader.onload = function(e) {\n      var data = e.target.result;\n\n      /* if binary string, read with type 'binary' */\n      var workbook = XLSX.read(data, {type: 'binary'});\n\n      /* DO SOMETHING WITH workbook HERE */\n    };\n    reader.readAsBinaryString(f);\n  }\n}\ndrop_dom_element.addEventListener('drop', handleDrop, false);\n```\n\n- HTML5 input file element using readAsBinaryString:\n\n```\nfunction handleFile(e) {\n  var files = e.target.files;\n  var i,f;\n  for (i = 0, f = files[i]; i != files.length; ++i) {\n    var reader = new FileReader();\n    var name = f.name;\n    reader.onload = function(e) {\n      var data = e.target.result;\n\n      var workbook = XLSX.read(data, {type: 'binary'});\n\n      /* DO SOMETHING WITH workbook HERE */\n    };\n    reader.readAsBinaryString(f);\n  }\n}\ninput_dom_element.addEventListener('change', handleFile, false);\n```\n\nThis example walks through every cell of every sheet and dumps the values:\n\n```\nvar sheet_name_list = workbook.SheetNames;\nsheet_name_list.forEach(function(y) {\n  var worksheet = workbook.Sheets[y];\n  for (z in worksheet) {\n    if(z[0] === '!') continue;\n    console.log(y + \"!\" + z + \"=\" + JSON.stringify(worksheet[z].v));\n  }\n});\n```\n\nComplete examples:\n\n- <http://oss.sheetjs.com/js-xlsx/> HTML5 File API / Base64 Text / Web Workers\n\nNote that older versions of IE does not support HTML5 File API, so the base64\nmode is provided for testing.  On OSX you can get the base64 encoding with:\n\n    $ <target_file.xlsx base64 | pbcopy\n\n- <http://oss.sheetjs.com/js-xlsx/ajax.html> XMLHttpRequest\n\n- <https://github.com/SheetJS/js-xlsx/blob/master/bin/xlsx.njs> nodejs\n\nThe nodejs version installs a binary `xlsx` which can read XLSX/XLSM/XLSB\nfiles and output the contents in various formats.  The source is available at\n`xlsx.njs` in the bin directory.\n\nSome helper functions in `XLSX.utils` generate different views of the sheets:\n\n- `XLSX.utils.sheet_to_csv` generates CSV\n- `XLSX.utils.sheet_to_json` generates an array of objects\n- `XLSX.utils.sheet_to_formulae` generates a list of formulae\n\n## Writing Workbooks\n\nAssuming `workbook` is a workbook object, just call write:\n\n- nodejs write to file:\n\n```\n/* output format determined by filename */\nXLSX.writeFile(workbook, 'out.xlsx');\n```\n\n- write to binary string (using FileSaver.js)\n\n```\n/* bookType can be 'xlsx' or 'xlsm' or 'xlsb' */\nvar wopts = { bookType:'xlsx', bookSST:false, type:'binary' };\n\nvar wbout = XLSX.write(workbook,wopts);\n\nfunction s2ab(s) {\n  var buf = new ArrayBuffer(s.length);\n  var view = new Uint8Array(buf);\n  for (var i=0; i!=s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;\n  return buf;\n}\n\nsaveAs(new Blob([s2ab(wbout)],{type:\"\"}), \"test.xlsx\")\n```\n\nComplete examples:\n\n- <http://sheetjs.com/demos/writexlsx.html> generates a simple file\n- <http://git.io/WEK88Q> writing an array of arrays in nodejs\n- <http://sheetjs.com/demos/table.html> exporting an HTML table\n\n## Interface\n\n`XLSX` is the exposed variable in the browser and the exported nodejs variable\n\n`XLSX.version` is the version of the library (added by the build script).\n\n`XLSX.SSF` is an embedded version of the [format library](http://git.io/ssf).\n\n### Parsing functions\n\n`XLSX.read(data, read_opts)` attempts to parse `data`.\n\n`XLSX.readFile(filename, read_opts)` attempts to read `filename` and parse.\n\n### Writing functions\n\n`XLSX.write(wb, write_opts)` attempts to write the workbook `wb`\n\n`XLSX.writeFile(wb, filename, write_opts)` attempts to write `wb` to `filename`\n\n### Utilities\n\nUtilities are available in the `XLSX.utils` object:\n\nExporting:\n\n- `sheet_to_json` converts a workbook object to an array of JSON objects.\n- `sheet_to_csv` generates delimiter-separated-values output\n- `sheet_to_formulae` generates a list of the formulae (with value fallbacks)\n\nCell and cell address manipulation:\n\n- `format_cell` generates the text value for a cell (using number formats)\n- `{en,de}code_{row,col}` convert between 0-indexed rows/cols and A1 forms.\n- `{en,de}code_cell` converts cell addresses\n- `{en,de}code_range` converts cell ranges\n\n## Workbook / Worksheet / Cell Object Description\n\njs-xlsx conforms to the Common Spreadsheet Format (CSF):\n\n### General Structures\n\nCell address objects are stored as `{c:C, r:R}` where `C` and `R` are 0-indexed\ncolumn and row numbers, respectively.  For example, the cell address `B5` is\nrepresented by the object `{c:1, r:4}`.\n\nCell range objects are stored as `{s:S, e:E}` where `S` is the first cell and\n`E` is the last cell in the range.  The ranges are inclusive.  For example, the\nrange `A3:B7` is represented by the object `{s:{c:0, r:2}, e:{c:1, r:6}}`. Utils\nuse the following pattern to walk each of the cells in a range:\n\n```\nfor(var R = range.s.r; R <= range.e.r; ++R) {\n  for(var C = range.s.c; C <= range.e.c; ++C) {\n    var cell_address = {c:C, r:R};\n  }\n}\n```\n\n### Cell Object\n\n| Key | Description |\n| --- | ----------- |\n| `v` | raw value ** |\n| `w` | formatted text (if applicable) |\n| `t` | cell type: `b` Boolean, `n` Number, `e` error, `s/str` String |\n| `f` | cell formula (if applicable) |\n| `r` | rich text encoding (if applicable) |\n| `h` | HTML rendering of the rich text (if applicable) |\n| `c` | comments associated with the cell ** |\n| `z` | number format string associated with the cell (if requested) |\n| `l` | cell hyperlink object (.Target holds link, .tooltip is tooltip) |\n| `s` | the style/theme of the cell (if applicable) |\n\n- For dates, `.v` holds the raw date code from the sheet and `.w` holds the text\n\nBuilt-in export utilities (such as the CSV exporter) will use the `w` text if it\nis available.  To change a value, be sure to delete `cell.w` (or set it to\n`undefined`) before attempting to export.  The utilities will regenerate the `w`\ntext from the number format (`cell.z`) and the raw value if possible.\n\n### Worksheet Object\n\nEach key that does not start with `!` maps to a cell (using `A-1` notation)\n\n`worksheet[address]` returns the cell object for the specified address.\n\nSpecial worksheet keys (accessible as `worksheet[key]`, each starting with `!`):\n\n- `ws['!ref']`: A-1 based range representing the worksheet range. Functions that\n  work with sheets should use this parameter to determine the range.  Cells that\n  are assigned outside of the range are not processed.  In particular, when\n  writing a worksheet by hand, be sure to update the range.  For a longer\n  discussion, see <http://git.io/KIaNKQ>\n\n  Functions that handle worksheets should test for the presence of `!ref` field.\n  If the `!ref` is omitted or is not a valid range, functions are free to treat\n  the sheet as empty or attempt to guess the range.  The standard utilities that\n  ship with this library treat sheets as empty (for example, the CSV output is an\n  empty string).\n\n  When reading a worksheet with the `sheetRows` property set, the ref parameter\n  will use the restricted range.  The original range is set at `ws['!fullref']`\n\n- `ws['!cols']`: array of column properties objects.  Column widths are actually\n  stored in files in a normalized manner, measured in terms of the \"Maximum\n  Digit Width\" (the largest width of the rendered digits 0-9, in pixels).  When\n  parsed, the column objects store the pixel width in the `wpx` field, character\n  width in the `wch` field, and the maximum digit width in the `MDW` field.\n\n- `ws['!merges']`: array of range objects corresponding to the merged cells in\n  the worksheet.  Plaintext utilities are unaware of merge cells.  CSV export\n  will write all cells in the merge range if they exist, so be sure that only\n  the first cell (upper-left) in the range is set.\n\n### Workbook Object\n\n`workbook.SheetNames` is an ordered list of the sheets in the workbook\n\n`wb.Sheets[sheetname]` returns an object representing the worksheet.\n\n`wb.Props` is an object storing the standard properties.  `wb.Custprops` stores\ncustom properties.\n\n\n## Parsing Options\n\nThe exported `read` and `readFile` functions accept an options argument:\n\n| Option Name | Default | Description |\n| :---------- | ------: | :---------- |\n| cellFormula | true    | Save formulae to the .f field |\n| cellHTML    | true    | Parse rich text and save HTML to the .h field |\n| cellNF      | false   | Save number format string to the .z field |\n| cellStyles  | false   | Save style/theme info to the .s field |\n| sheetStubs  | false   | Create cell objects for stub cells |\n| sheetRows   | 0       | If >0, read the first `sheetRows` rows ** |\n| bookDeps    | false   | If true, parse calculation chains |\n| bookFiles   | false   | If true, add raw files to book object ** |\n| bookProps   | false   | If true, only parse enough to get book metadata ** |\n| bookSheets  | false   | If true, only parse enough to get the sheet names |\n| bookVBA     | false   | If true, expose vbaProject.bin to `vbaraw` field ** |\n\n- Even if `cellNF` is false, formatted text (.w) will be generated\n- In some cases, sheets may be parsed even if `bookSheets` is false.\n- `bookSheets` and `bookProps` combine to give both sets of information\n- `Deps` will be an empty object if `bookDeps` is falsy\n- `bookFiles` adds a `keys` array (paths in the ZIP) and a `files` hash (whose\n  keys are paths and values are objects representing the files)\n- `sheetRows-1` rows will be generated when looking at the JSON object output\n  (since the header row is counted as a row when parsing the data)\n- `bookVBA` merely exposes the raw vba object.  It does not parse the data.\n\nThe defaults are enumerated in bits/84_defaults.js\n\n## Writing Options\n\nThe exported `write` and `writeFile` functions accept an options argument:\n\n| Option Name | Default | Description |\n| :---------- | ------: | :---------- |\n| bookSST     | false   | Generate Shared String Table ** |\n| bookType    | 'xlsx'  | Type of Workbook (\"xlsx\" or \"xlsm\" or \"xlsb\") |\n\n- `bookSST` is slower and more memory intensive, but has better compatibility\n  with older versions of iOS Numbers\n- `bookType = 'xlsb'` is stubbed and far from complete\n- The raw data is the only thing guaranteed to be saved.  Formulae, formatting,\n  and other niceties may not be serialized (pending CSF standardization)\n\n## Tested Environments\n\n - NodeJS 0.8, 0.10 (latest release), 0.11 (unstable)\n - IE 6/7/8/9/10/11 using Base64 mode (IE10/11 using HTML5 mode)\n - FF 18 using Base64 or HTML5 mode\n - Chrome 24 using Base64 or HTML5 mode\n\nTests utilize the mocha testing framework.  Travis-CI and Sauce Labs links:\n\n - <https://travis-ci.org/SheetJS/js-xlsx> for XLSX module in nodejs\n - <https://travis-ci.org/SheetJS/SheetJS.github.io> for XLS* modules\n - <https://saucelabs.com/u/sheetjs> for XLS* modules using Sauce Labs\n\n## Test Files\n\nTest files are housed in [another repo](https://github.com/SheetJS/test_files).\n\nRunning `make init` will refresh the `test_files` submodule and get the files.\n\n## Testing\n\n`make test` will run the nodejs-based tests.  To run the in-browser tests, clone\n[the oss.sheetjs.com repo](https://github.com/SheetJS/SheetJS.github.io) and\nreplace the xlsx.js file (then fire up the browser and go to `stress.html`):\n\n```\n$ cp xlsx.js ../SheetJS.github.io\n$ cd ../SheetJS.github.io\n$ simplehttpserver # or \"python -mSimpleHTTPServer\" or \"serve\"\n$ open -a Chromium.app http://localhost:8000/stress.html\n```\n\nFor a much smaller test, run `make test_misc`.\n\n## Contributing\n\nDue to the precarious nature of the Open Specifications Promise, it is very\nimportant to ensure code is cleanroom.  Consult CONTRIBUTING.md\n\nThe xlsx.js file is constructed from the files in the `bits` subdirectory. The\nbuild script (run `make`) will concatenate the individual bits to produce the\nscript.  Before submitting a contribution, ensure that running make will produce\nthe xlsx.js file exactly.  The simplest way to test is to move the script:\n\n```\n$ mv xlsx.js xlsx.new.js\n$ make\n$ diff xlsx.js xlsx.new.js\n```\n\n## XLS Support\n\nXLS is available in [js-xls](http://git.io/xls).\n\n## License\n\nPlease consult the attached LICENSE file for details.  All rights not explicitly\ngranted by the Apache 2.0 license are reserved by the Original Author.\n\nIt is the opinion of the Original Author that this code conforms to the terms of\nthe Microsoft Open Specifications Promise, falling under the same terms as\nOpenOffice (which is governed by the Apache License v2).  Given the vagaries of\nthe promise, the Original Author makes no legal claim that in fact end users are\nprotected from future actions.  It is highly recommended that, for commercial\nuses, you consult a lawyer before proceeding.\n\n## References\n\nISO/IEC 29500:2012(E) \"Information technology — Document description and processing languages — Office Open XML File Formats\"\n\nOSP-covered specifications:\n\n - [MS-XLSB]: Excel (.xlsb) Binary File Format\n - [MS-XLSX]: Excel (.xlsx) Extensions to the Office Open XML SpreadsheetML File Format\n - [MS-OE376]: Office Implementation Information for ECMA-376 Standards Support\n - [MS-XLDM]: Spreadsheet Data Model File Format\n\n## Badges\n\n[![Build Status](https://travis-ci.org/SheetJS/js-xlsx.svg?branch=master)](https://travis-ci.org/SheetJS/js-xlsx)\n\n[![Coverage Status](http://img.shields.io/coveralls/SheetJS/js-xlsx/master.svg)](https://coveralls.io/r/SheetJS/js-xlsx?branch=master)\n\n[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/ed5bb2c4c4346a474fef270f847f3f78 \"githalytics.com\")](http://githalytics.com/SheetJS/js-xlsx)\n","readmeFilename":"README.md"}