
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
aspose.cells.node.samples
Advanced tools
Aspose.Cells for Node.js via C++ is a powerful and robust library designed for high-performance spreadsheet manipulation and management within Node.js applications. It offers a comprehensive set of features that enable developers to create, edit, convert, and render Excel files programmatically. Supporting all major Excel formats, including XLS, XLSX, XLSM, and more, it ensures compatibility and flexibility. This makes Aspose.Cells for Node.js via C++ a versatile tool for a wide range of data processing and management tasks, providing developers with a complete and efficient solution for integrating comprehensive Excel functionality into their Node.js applications.
const AsposeCells = require("aspose.cells.node");
var workbook = new AsposeCells.Workbook(AsposeCells.FileFormatType.Xlsx);
workbook.getWorksheets().get(0).getCells().get("A1").putValue("Hello World");
workbook.save("hello-world.xlsx");
const fs = require("fs");
const { Workbook, SaveFormat } = require("aspose.cells.node");
Workbook.openAsync("example.xlsx")
.then(workbook => {
workbook.calculateFormulaAsync()
.then(() => {
workbook.saveAsync(SaveFormat.Pdf)
.then((buffer) => {
var writeStream = fs.createWriteStream("example.pdf");
writeStream.write(buffer);
writeStream.end();
})
.catch(error => {
console.error(error);
});
})
.catch(error => {
console.error(error);
});
})
.catch(error => {
console.error(error);
});
import AsposeCells from "aspose.cells.node";
const { Workbook, FileFormatType } = AsposeCells;
var workbook = new Workbook(FileFormatType.Xlsx);
workbook.getWorksheets().get(0).getCells().get("A1").putValue("Hello World");
workbook.save("hello-world.xlsx");
Note: Please save the above code as example.mjs file and run it using node example.mjs
.
const { Workbook } = require("aspose.cells.node");
var workbook = new Workbook("example.xlsx");
workbook.save("pdf-example.pdf");
const { Workbook, Color } = require("aspose.cells.node");
var workbook = new Workbook();
var style = workbook.createStyle();
style.getFont().setName("Times New Roman");
var blue = new Color(0, 0, 0xff);
style.getFont().setColor(blue);
for (var i = 0; i < 10; i++) {
var cell = workbook.getWorksheets().get(0).getCells().get(0, i);
cell.putValue(i);
cell.setStyle(style);
}
workbook.save("style-example.xlsx");
const { Workbook, SaveFormat } = require("aspose.cells.node");
var workbook = new Workbook();
var sheetIndex = workbook.getWorksheets().add();
var worksheet = workbook.getWorksheets().get(sheetIndex);
// adding a picture at "F6" cell
worksheet.getPictures().add(5, 5, "image.gif");
workbook.save("picture-example.xls", SaveFormat.Excel97To2003);
const { Workbook, CalculationOptions, AbstractCalculationEngine } = require("aspose.cells.node");
class CustomFunction extends AbstractCalculationEngine {
constructor() {
super();
}
calculate(data) {
var functionName = data.getFunctionName();
if (functionName == "myarrayfunch") {
var r = new Array();
r[0] = [1.0, 2.0, 3.0, 4.0, 5.0];
data.setCalculatedValue(r);
return;
}
else if (functionName == "myarrayfuncv") {
var r = new Array();
r[0] = [1.0];
r[1] = [2.0];
r[2] = [3.0];
r[3] = [4.0];
r[4] = [5.0];
data.setCalculatedValue(r);
return;
}
else if (functionName == "myrange") {
data.setCalculatedValue(data.getWorksheet().getCells().createRange("A1", "F1"));
return;
}
else if (functionName == "UDFTest") {
data.setCalculatedValue(data.getParamValue(0));
}
}
};
var wb = new Workbook();
var sheet = wb.getWorksheets().get(0);
var cells = sheet.getCells();
// Create table with data
var range = cells.createRange("B3:D5");
var arr = new Array();
arr[0] = ["AccountNum", "UDF", "Normal"];
arr[1] = ["Row01", "", ""];
arr[2] = ["Row02", "", ""];
range.setValue(arr);
var firstRow = range.getFirstRow();
var firstColumn = range.getFirstColumn();
var endRow = firstRow + range.getRowCount();
var endColumn = firstColumn + range.getColumnCount();
sheet.getListObjects().add(firstRow, firstColumn, endRow, endColumn, true);
// Populate formulas
cells.get("C5").setFormula("=UDFTest([@AccountNum])");
cells.get("C4").setFormula("=UDFTest([@AccountNum])"); // UDF formula
cells.get("D5").setFormula("=[@AccountNum]");
cells.get("D4").setFormula("=[@AccountNum]"); // Built-in formula comparison
// Calculate workbook
var opt = new CalculationOptions();
var customFunction = new CustomFunction();
opt.setCustomEngine(customFunction);
wb.calculateFormula(opt);
console.log("Row01" == cells.get("C4").getStringValue());
console.log("Row02" == cells.get("C5").getStringValue());
console.log("Row01" == cells.get("D4").getStringValue());
console.log("Row02" == cells.get("D5").getStringValue());
var workbook = new Workbook();
var worksheet = workbook.getWorksheets().get(0);
// Get the cells collection in the sheet
var cells = worksheet.getCells();
cells.get("A1").setArrayFormula("=myarrayfunch()", 1, 5);
cells.get("A2").setArrayFormula("=myarrayfuncv()", 5, 1);
cells.get("A7").setArrayFormula("=A1:E1*100", 1, 5);
cells.get("A8").setFormula("=sum(myrange())", 100);
var cf = new CustomFunction();
var cOpt = new CalculationOptions();
cOpt.setCustomEngine(cf);
workbook.calculateFormula(cOpt);
for (var i = 0; i < 5; i++) {
console.log(i + 1.0 == cells.get(0, i).getDoubleValue());
}
for (var i = 1; i < 6; i++) {
console.log(i == cells.get(i, 0).getDoubleValue());
}
for (var i = 0; i < 5; i++) {
console.log(i * 100 + 100.0 == cells.get(6, i).getDoubleValue());
}
console.log(cells.get("A8").getDoubleValue() == 15);
console.log("done");
Please refer to aspose.cells.node.samples package for more code samples.
Product Page | Product Documentation | Blog |API Reference | Free Support | Temporary License
FAQs
This is the sample code using aspose.cells.node library.
The npm package aspose.cells.node.samples receives a total of 10 weekly downloads. As such, aspose.cells.node.samples popularity was classified as not popular.
We found that aspose.cells.node.samples demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.