1. Products
  2.   Aspose.Cells
  3.   Aspose.Cells FOSS for TypeScript

Aspose.Cells FOSS for TypeScript

Create, modify, and export Excel spreadsheets from TypeScript – free and open-source, zero Microsoft Office dependency.

Open-Source TypeScript Library for Excel Spreadsheets

Aspose.Cells FOSS for TypeScript is a free, open-source library for working with spreadsheet files in TypeScript applications. Install it with npm install @aspose/cells@1.0.0 and start creating workbooks, reading cells, applying styles, building charts, and exporting to XLSX, CSV, Markdown, JSON, or HTML – all without requiring Microsoft Excel or any Office dependency.

The library exposes a clean API built around Workbook, Worksheet, Cell, and Style – the familiar objects every spreadsheet developer knows. Read and write cells using putValue(), style them with Style, Font, and Fill objects, add charts via ChartCollection, and set up data validation, auto-filters, comments, and hyperlinks on any worksheet.

Because the library has no dependency on native Office libraries, it runs identically on Windows, Linux, and macOS CI runners, Docker containers, and serverless environments. The codebase is MIT-licensed, hosted on GitHub, and accepts bug reports and pull requests. Developers who need the complete commercial API with full production support can use Aspose.Cells for TypeScript alongside these open-source resources.

Read and Write Excel Files

  • XLSX round-trip: Load workbooks with Workbook.load() and save with workbook.save() preserving cell values, formulas, and styles.
  • Cell access: Read and write values with worksheet.putValue() and worksheet.getCell() by row/column index or cell reference.
  • Formulas: Write formula strings via cell.setFormula() – stored verbatim in XLSX, evaluated by Excel or LibreOffice on open.
  • Multiple worksheets: Create, rename, move, and remove worksheets with WorksheetCollection methods including addWorksheet(), removeWorksheet(), and moveWorksheet().

Where Aspose.Cells FOSS Can Be Used

  • Data pipelines: Export database query results directly to XLSX or CSV using workbook.toCsv().
  • Report generation: Build styled, branded Excel reports without Office installed.
  • Documentation: Convert spreadsheets to Markdown via workbook.toMarkdown().
  • ETL workflows: Read input sheets, transform data, and write output workbooks.
  • CI/CD automation: Generate test-result spreadsheets inside Docker containers.

Styling, Charts, and Shapes

  • Font and fill: Apply bold, italic, font size, and colors via Style with setBold(), setItalic(), setFontSize(), and setFontColor().
  • Number formats: Set date, currency, and custom number formats per cell using numFmtId in Style.
  • Charts: Build bar, line, pie, area, and scatter charts with ChartCollection and render chart data via ChartRenderer.
  • Shapes: Add vector shapes to worksheets with addShape() supporting rectangles, ellipses, arrows, connectors, and more via the ShapeInfo hierarchy.

Export and Protection

  • Multi-format export: Save to XLSX, CSV, JSON, Markdown, and HTML using workbook.save() or dedicated methods like toJson(), toCsv(), toMarkdown(), and toHtml().
  • HTML import and export: Load HTML tables with HtmlReader and export styled workbooks with HtmlExporter.
  • Workbook protection: Protect workbooks with a password using workbook.protect(true, "password").
  • Cell protection: Lock individual cells with style.setLocked(true) and control formula visibility with style.setHidden().

Data Validation and Filtering

  • Data validation: Add list, number, and custom validation rules to cell ranges with DataValidation and worksheet.addDataValidation().
  • Auto-filter: Set filterable column headers with worksheet.setAutoFilter() and remove filters with removeAutoFilter().
  • Conditional formatting: Apply color scales, data bars, and icon sets via ConditionalFormatCollection with ColorScaleRule, DataBarRule, and IconSetRule.
  • Comments: Attach cell comments with Comment objects via worksheet.addComment().

Developer Experience

Aspose.Cells FOSS for TypeScript is installable with a single npm install @aspose/cells@1.0.0 command. There are no native Office libraries or system packages to install. The library runs on any Node.js environment with TypeScript 5+ support.

The API covers Workbook, Worksheet, Cell, Style, Font, Fill, Chart, DataValidation, AutoFilter, Comment, Hyperlink, and Shape – the core objects for real-world spreadsheet automation. The codebase is MIT-licensed, hosted on GitHub, and accepts bug reports and pull requests.

Write Cell Values and Formulas

Create a workbook, write different value types to cells, and set formulas that Excel evaluates on open.

const workbook = new Workbook();
const worksheet = workbook.worksheets[0]!;
worksheet.putValue("A1", 42);
worksheet.putValue("A2", 3.14159);
worksheet.putValue("A3", "Hello World");
const cellA4 = worksheet.getCell2("A4");
cellA4.setFormula("=SUM(A1:A2)");
await workbook.save("output.xlsx");

Apply Font Styling

Set font name, size, bold, italic, and color on a cell using the Style class.

const workbook = new Workbook();
const worksheet = workbook.worksheets[0]!;
const style = new Style();
style.setFontName("Arial");
style.setFontSize(14);
style.setBold(true);
style.setItalic(true);
style.setFontColor("FF0000");
const cell = worksheet.getCell2("A1");
cell.putValue("Styled Text");
cell.setStyle(style);
await workbook.save("styled.xlsx");

Set Up Auto-Filter

Populate a data range and enable auto-filter headers for interactive column filtering in Excel.

const workbook = new Workbook();
const worksheet = workbook.worksheets[0]!;
worksheet.putValue("A1", "Name");
worksheet.putValue("B1", "Age");
worksheet.putValue("C1", "City");
worksheet.putValue("A2", "Alice");
worksheet.putValue("B2", "25");
worksheet.putValue("C2", "New York");
worksheet.putValue("A3", "Bob");
worksheet.putValue("B3", "30");
worksheet.putValue("C3", "London");
worksheet.setAutoFilter("A1:C4");
await workbook.save("filtered.xlsx");

Frequently Asked Questions

What is Aspose.Cells FOSS for TypeScript?

It is a free, MIT-licensed TypeScript library for creating, reading, modifying, and exporting Excel spreadsheets without requiring Microsoft Office.

Which file formats are supported?

XLSX for read/write. Export-only formats include CSV, JSON, Markdown, and HTML. HTML can also be imported via HtmlReader.

Does it require Microsoft Excel or Office?

No. Aspose.Cells FOSS is a pure TypeScript library with no dependency on Microsoft Office, COM automation, or any proprietary runtime.

How do I install it?

Run npm install @aspose/cells@1.0.0. No additional system packages or native extensions are required.

Can I apply cell styling?

Yes. Use the Style class with methods like setBold(), setItalic(), setFontSize(), setFontName(), and setFontColor() to style individual cells.

Is workbook protection supported?

Yes. Call workbook.protect(true, “password”) to protect a workbook with a password. Individual cells can be locked with style.setLocked(true).

  

Support and Learning Resources