Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Simple data wrapper that attempts to wrap SheetJS libraries to provide a uniform way to access data from Excel and other spreadsheet files:
Excel files are parsed based on the content (not by filename). For example, CSV files can be renamed to .XLS and excel will do the right thing.
Supported Formats:
Format | Library |
---|---|
XLS (BIFF5, 5.0-7.0) | JS-XLS |
XLS (BIFF8, 97-2003) | JS-XLS |
XLSX (2007+) | JS-XLSX |
XLSM (2007+ w/macros) | JS-XLSX |
XLSB (2007+ binary) | JS-XLSX |
XML (2003/2004) | JS-XLS |
DIF (plaintext) | JS-HARB |
UTF-16 Text | JS-HARB |
CSV / TSV | JS-HARB |
SYLK (Symbolic Link) | JS-HARB |
ODS (OpenDocument) | JS-XLSX |
SocialCalc | JS-HARB |
Output formats:
A1=NOW()
, A2=A1+3
)npm install -g j
var J = require('j');
J.readFile(filename)
opens the file specified by filename and returns an array
whose first object is the parsing object (XLS or XLSX) and whose second object
is the parsed file.
J.utils
has various helpers that expect an array like those from readFile:
to_csv(w) / to_dsv(w, delim)
will generate CSV/DSV respectivelyto_json(w)
will generate JSON row objectsto_html(w)
will generate simple HTML tablesto_formulae(w)
will generate lists of formulaeto_xml(w)
will generate simple XMLto_xlsx(w) / to_xlsm(w) / to_xlsb(w)
will generate XLSX/XLSM/XLSB workbooksto_md(w)
will generate markdown tablesThe node module ships with a binary j
which has a help message:
$ j --help
Usage: j [options] <file> [sheetname]
Options:
-h, --help output usage information
-V, --version output the version number
-f, --file <file> use specified file (- for stdin)
-s, --sheet <sheet> print specified sheet (default first sheet)
-N, --sheet-index <idx> use specified sheet index (0-based)
-l, --list-sheets list sheet names and exit
-o, --output <file> output to specified file
-B, --xlsb emit XLSB to <sheetname> or <file>.xlsb
-M, --xlsm emit XLSM to <sheetname> or <file>.xlsm
-X, --xlsx emit XLSX to <sheetname> or <file>.xlsx
-S, --formulae print formulae
-j, --json emit formatted JSON (all fields text)
-J, --raw-js emit raw JS object (raw numbers)
-x, --xml emit XML
-H, --html emit HTML
-m, --markdown emit markdown table (with pipes)
-E, --socialcalc emit socialcalc
-F, --field-sep <sep> CSV field separator
-R, --row-sep <sep> CSV row separator
-n, --sheet-rows <num> Number of rows to process (0=all rows)
--dev development mode
--read read but do not print out contents
-q, --quiet quiet mode
Please consult the attached LICENSE file for details. All rights not explicitly granted by the Apache 2.0 license are reserved by the Original Author.
Using git textconv, you can use J
to generate more meaningful diffs!
One-time configuration (misc/gitdiff.sh
):
#!/bin/bash
# Define a sheetjs diff type that uses j
git config --global diff.sheetjs.textconv "j"
# Configure a user .gitattributes file that maps the xls{,x,m} files
touch ~/.gitattributes
cat <<EOF >>~/.gitattributes
*.xls diff=sheetjs
*.xlsb diff=sheetjs
*.xlsm diff=sheetjs
*.xlsx diff=sheetjs
*.XLS diff=sheetjs
*.XLSB diff=sheetjs
*.XLSM diff=sheetjs
*.XLSX diff=sheetjs
EOF
# Set the .gitattributes to be used for all repos on the system:
git config --global core.attributesfile '~/.gitattributes'
If you just want to compare formulae (for example, in a sheet using NOW
):
git config --global diff.sheetjs.textconv "j -S"
NOTE: There are some known issues regarding global modules in Windows. The best
bet is to npm install j
in your git directory before diffing.
Segmentation faults in node v0.10.31 stem from a bug in node. J will throw an error if it is running under that version. Since versions prior to v0.10.30 do not exhibit the problem, rolling back to a previous version of node is the best remedy. See https://github.com/joyent/node/issues/8208 for more information.
FAQs
CLI tool for working with XLS/XLSX/XLSM/XLSB files
The npm package j-org receives a total of 2 weekly downloads. As such, j-org popularity was classified as not popular.
We found that j-org demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.