
Product
Introducing Webhook Events for Pull Request Scans
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
@dictadata/xlsx-junction
Advanced tools
dictadata Storage Junction for .xlsx, .xls and .ods files.
A Storage Junction for Excel .xlsx and .xls files. XlsxJunction implements a junction for reading tabular data from Excel .xlsx, .xls, .ods files. XlsxJunction is a storage plugin for use with @dictadata/storage-junctions and related projects @dictadata/storage-tracts ETL command line utility and @dictadata/storage-node API Server.
The plugin uses the SheetJS XLSX module to parse the XLSX documents.
npm install @dictadata/storage-junctions @dictadata/xlsx-junction
Register the junction when initializing the app. Import the Storage Junctions library and the XLSX Junction plugin. Then register XLSX Junction with the Storage Junctions' Storage
module. This will register XLSX Junction for use with storage model "xlsx"
.
const { Storage } = require("@dictadata/storage-junctions");
const { XlsxJunction } = require("@dictadata/xlsx-junction");
Storage.Junctions.use("xlsx", XlsxJunction);
Storage.Junctions.use('xls', XlsxJunction);
Storage.Junctions.use('ods', XlsxJunction);
Create an instance of XLSXJunction
class. Then a junction can be created as needed in the app using an SMT definition.
const Storage = require("@dictadata/storage-junctions");
var junction = Storage.activate("xlsx|file:folderpath/workbook.xlsx|sheet name|*", options);
// or
var junction = Storage.activate({
model:"xlsx",
locus: "file:folderpath/workbook.xlsx",
schema: "sheet name",
key: "column name"
}, options);
Supported filesystem are those built into the storage-junctions library. Currently the supported file systems types are:
/**
* @param {String|Object} SMT 'xlsx|file:filename|sheetname|key' or an Engram object
* @param {object} options
* @param {boolean} [raw] - output all raw in worksheet with cell properties
* @param {string} [range] - A1-style range, e.g. "A3:M24"
* @param {boolean} [overwrite] - overwrite/create workbook file
* @param {string} [sheetName] - sheet name to use instead of SMT.schema, default none
* @param {boolean} [cellDates] - default true, format date cell values as UTC strings
*
* XLSX.readFile()
* read workbook options:
* "cellFormula", "cellHTML", "cellNF", "cellStyles", "cellText", "cellDates"
* https://docs.sheetjs.com/docs/api/parse-options
*
* XLSX.writeFile()
* write workbook options:
* "cellDates", "type", "bookSST", "bookType", "sheet", "compression", "Props", "themeXLSX", "ignoreEC"
* https://docs.sheetjs.com/docs/api/write-options
*/
/**
* @param {object} junction - parent XlsxJunction
* @param {object} [options]
* @param {number} [options.max_read] - maximum rows to read
* @param {boolean} [options.raw] - output all raw in worksheet with cell properties
* @param {string} [options.range] - A1-style range, e.g. "A3:M24"
* @param {string} [options.heading] PDF section heading where data is located, default: none
* @param {string} [options.stopHeading] PDF section heading after data table, default: none
* @param {number} [options.cells] minimum number of cells in a row, default: 1
* @param {boolean} [options.repeating] indicates if table headers are repeated on each page, default: false
* @param {string[]} [options.headers] - RowAsObject: array of column names for data, default none, first table row contains names.
* @param {number} [options.column] - RepeatCellTransform: column index of cell to repeat, default 0
* @param {string} [options.header] - RepeatHeadingTransform: column name for the repeating heading field
*
* sheet_to_json() read options:
* "raw", "range", "header", "dateNF", "defval", "blankrows", "skipHidden", "UTC"
* https://docs.sheetjs.com/docs/api/utilities/array#array-output
*/
/**
* @param {object} junction - parent XlsxJunction
* @param {object} [options]
* @param {boolean} [raw] - constructs are worksheet cells with cell properties
*
* json_to_sheet() write options:
* "cellDates", "origin", "header", "dateNF", "skipHeader"
* https://docs.sheetjs.com/docs/api/utilities/array#array-of-objects-input
*/
The following examples use the State_Voter_Registration_2024_PPE.xlsx file found in the project's test/data/input folder. Examples use Storage Tracts CLI options format to define a tract fiber.
{
origin: {
smt: "xlsx|./test/data/input/State_Voter_Registration_2024_PPE.xlsx|in|*",
options: {
raw: true,
cellDates: false
}
},
terminal: {
smt: "json|./test/data/output/xlsx/|svr_all_rows.json|*"
}
}
{
origin: {
smt: "xlsx|./test/data/input/State_Voter_Registration_2024_PPE.xlsx|in|*",
options: {
heading: "Active",
cells: 9,
column: 0
}
},
terminal: {
smt: "json|./test/data/output/xlsx/|svr_heading.json|*"
}
}
Retrieves the same data table as previous example.
{
origin: {
smt: "xlsx|./test/data/input/State_Voter_Registration_2024_PPE.xlsx|in|*",
options: {
range: "A6:R70",
column: 0
}
},
terminal: {
smt: "json|./test/data/output/xlsx/|svr_range.json|*"
}
}
{
origin: {
smt: "xlsx|./test/data/input/State_Voter_Registration_2024_PPE.xlsx|in|*",
options: {
range: "A77:S134",
header: "County:1"
}
},
terminal: {
smt: "json|./test/data/output/xlsx/|svr_repeat.json|*"
}
}
FAQs
dictadata Storage Junction for .xlsx, .xls and .ods files.
The npm package @dictadata/xlsx-junction receives a total of 0 weekly downloads. As such, @dictadata/xlsx-junction popularity was classified as not popular.
We found that @dictadata/xlsx-junction demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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.
Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.