node-excelutil
v1.0.1
Published
provide funtions to hanlde Excel file with NodeJS
Downloads
4
Readme
Node EXCEL
Usage
npm install node-excelutil
Examples
- initial from excel file
var NodeExcel = require ("node-excelutil");
// import from a file
var excel = new NodeExcel(filePath, sheetName);
// import from a two dimensional arrays
var excel = new NodeExcel([[1,2,3],[4,5,6],[7,8,9]]);
- APIS
getData(columnFrom, rawFrom, columnTo , rawTo)
var NodeExcel = require ("./index.js");
var excel = new NodeExcel(filePath, sheetName);
// Single Data
excel.getData("A2", 6);
// Get data from A1,0 to CC,50
getData("A", 0, "CC" , 50);
// Also support number
getData(0, 0, 70, 50);
replaceData(data, columnFrom, rawFrom, columnTo, rawTo)
var NodeExcel = require ("./index.js");
var excel = new NodeExcel(filePath, sheetName);
// Replace single data
excel.replaceData("123", "A2", 6);
// Replace a area
excel.replaceData([[1,1,1],[2,2,2]], "A", 0, "A", 3);
// Also support number
excel.replaceData([[1,1,1],[2,2,2]], 0, 0, 3, 3);
transposeData(columnFrom, rawFrom, columnTo , rawTo)
var NodeExcel = require ("./index.js");
var excel = new NodeExcel([[1,2,3,],[4,5,6],[11,12,13]]);
var newFile = excel.transposeData(0,0,3,3);
// result newFile = [ [ 1, 4, 11 ], [ 2, 5, 12 ], [ 3, 6, 13 ] ]
createNewFile(fileName, sheetName, path, data)
excel.createNewFile("new.xlsx", "textNew", "./", newFile);