
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@vizabi/reader-excel
Advanced tools
The main goal of this repo is to provide ability for Vizabi to work with XLS and XLSX data.
npm i vizabi-excel-reader
import * as path from 'path';
import { excelReaderObject as excelReaderPlainObject } from 'vizabi-excel-reader';
global.d3 = require('d3');
global.Vizabi = require('vizabi');
const ExcelReader = global.Vizabi.Reader.extend(excelReaderPlainObject);
const excelReaderObject = new ExcelReader({
path: path.resolve('path to XLS file'),
sheet: 'basic'
});
const result = await excelReaderObject.load();
console.log(result);
<script src="node_modules/vizabi-excel-reader/dist/vizabi-excel-reader.js"></script>
<script>
// ExcelReader global variable was imported by script above
Vizabi.Reader.extend("excel-reader", ExcelReader.excelReaderObject);
// use "excel-reader" as a Vizabi init parameter
// .....
</script>
import * as fs from 'fs';
import { excelReaderObject as excelReaderPlainObject } from 'vizabi-excel-reader';
global.d3 = require('d3');
global.Vizabi = require('vizabi');
const readJson = (filePath, onFileRead) => {
fs.stat(filePath, (fileErr, stat) => {
if (fileErr) {
return onFileRead(fileErr);
}
if (stat.code === 'ENOENT') {
return onFileRead('No such file: ' + filePath);
}
fs.readFile(filePath, 'utf-8', (readErr, content) => {
if (readErr) {
return onFileRead(readErr);
}
try {
onFileRead(null, JSON.parse(content.toString()));
} catch (e) {
onFileRead(e);
}
});
});
};
const ExcelReader = global.Vizabi.Reader.extend(excelReaderPlainObject);
const excelReaderObject = new ExcelReader({
assetsPath: 'path to assets', // must be ended with '/'
additionalJsonReader: readJson
});
const result = await excelReaderObject.getAsset('asset file name');
console.log(result);
import * as path from 'path';
import { excelReaderObject as excelReaderPlainObject } from 'vizabi-excel-reader';
global.d3 = require('d3');
global.Vizabi = require('vizabi');
const ExcelReader = global.Vizabi.Reader.extend(excelReaderPlainObject);
const excelReaderObject = new ExcelReader({
path: path.resolve('path to XLS file'),
sheet: 'basic'
});
const result = await excelReaderObject.getWorksheets();
console.log(result);
path - path to XLS file that would be processedtimeInColumns - a flag that indicates that Excel file contains data in time-in-columns format (false by default)sheet- XLS sheet to open, can be a number or a string. In case of number it should be
an order number of the expected sheet, in case of string it should be a name of
the expected sheet (0 is default)lastModified - last modification date (optional)keySize - key size (1 by default)hasNameColumn - an extra column that contains country name (should not be processed, optional, false by default)nameColumnIndex - index of nameColumn (default value is 0)assetsPath - path to assets JSON file (optional, must be ended with '/')additionalTextReader - function that should replace tenured text reading function
(optional, see examples above, could be useful on frontend or testing)additionalJsonReader - function that should replace tenured JSON reading function
(optional, see examples above, could be useful on frontend or testing)npm test
git clone https://github.com/vizabi/vizabi-excel-reader.git
cd vizabi-excel-reader
npm i
npm run build
The result is a couple of directories: dist and lib.
dist contain two files: vizabi-excel-reader.js and vizabi-excel-reader.js.map. These files could be used
on frontend: see Usage on frontend
lib (lib/index.js) - is used 'by default' (see main section of package.json) and could be used on
backend (see Usage on backend)
FAQs
Vizabi reader for a Excel files
We found that @vizabi/reader-excel demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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 software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.