New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

aspose.cells.node

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aspose.cells.node

Aspose.Cells for Node.js via C++ is a high-performance and powerful library for manipulating and converting Excel (XLS, XLSX, XLSB), ODS, CSV, and HTML files, offering a comprehensive set of features for creating, editing, converting, and rendering spread

  • 25.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
96
decreased by-25%
Maintainers
0
Weekly downloads
 
Created
Source

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.

Key features

  • File Creation and Editing: Create new spreadsheets from scratch or edit existing ones with ease. This includes adding or modifying data, formatting cells, managing worksheets, and more.
  • Data Processing: Perform complex data manipulations such as sorting, filtering, and validation. The library also supports advanced formulas and functions to facilitate data analysis and calculations.
  • File Conversion: Convert Excel files to various formats such as PDF, HTML, ODS, and image formats like PNG and JPEG. This feature is useful for sharing and distributing spreadsheet data in different formats.
  • Chart and Graphics: Create and customize a wide range of charts and graphics to visually represent data. The library supports bar charts, line charts, pie charts, and many more, along with customization options for design and layout.
  • Rendering and Printing: Render Excel sheets to high-fidelity images and PDFs, ensuring that the visual representation is accurate. The library also provides options for printing spreadsheets with precise control over page layout and formatting.
  • Advanced Protection and Security: Protect spreadsheets with passwords, encrypt files, and manage access permissions to ensure data security and integrity.
  • Performance and Scalability: Designed to handle large datasets and complex spreadsheets efficiently, Aspose.Cells for Node.js via C++ ensures high performance and scalability for enterprise-level applications.

Read & Write Excel Files

  • Microsoft Excel: XLS, XLSX, XLSB, XLTX, XLTM, XLSM, XML
  • OpenOffice: ODS
  • Text: CSV, Tab-Delimited, TXT, JSON
  • Web: HTML, MHTML

Save Excel Files As

  • Fixed Layout: PDF, XPS
  • Images: JPEG, PNG, BMP, SVG, TIFF, GIF, EMF
  • Text: CSV, Tab-Delimited, JSON, SQL, XML

Support multiple operating systems and CPU architectures, including:

  • Windows x64
  • Linux x64
  • macOS x64 & arm64

Getting Started with Aspose.Cells for Node.js via C++

Create Excel XLSX File from Scratch

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");
Use import of ES6
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.

Convert Excel XLSX File to PDF

const { Workbook } = require("aspose.cells.node");

var workbook = new Workbook("example.xlsx");
workbook.save("pdf-example.pdf");

Format Excel Cells

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");

Add Picture to Excel Worksheet

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);

Calculate Custom Functions

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");

Product Page | Product Documentation | Blog |API Reference | Free Support | Temporary License

Keywords

FAQs

Package last updated on 12 Jan 2025

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc