BoxLang ๐Ÿš€ A New JVM Dynamic Language Learn More...

BoxLang+ Spreadsheet

v1.0.0+2 BoxLang Modules

BoxLang+ Spreadsheet Module ๐Ÿ“Š

A powerful BoxLang module for creating, reading, and manipulating Excel spreadsheet files.

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘          โšก B o x L a n g  S p r e a d s h e e t     โ•‘
โ•‘      Dynamic ยท Powerful ยท Production-Ready            โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
Copyright Since 2023 by Ortus Solutions, Corp
www.boxlang.io | www.ortussolutions.com

๐ŸŽฏ Overview

The BoxLang+ Spreadsheet Module (bx-spreadsheet) is a comprehensive library for Excel file manipulation in BoxLang. Built on Apache POI, it provides three distinct APIs to suit different coding styles:

API Type Entry Point Use Case
Fluent API โœจSpreadsheet() Modern chainable interface (recommended)
BIF Functions ๐Ÿ“šSpreadsheetNew(), etc.Traditional function-based approach
Component Tag ๐Ÿท๏ธ<bx:spreadsheet> Declarative CFML-compatible syntax

๐Ÿ’ก Recommended: Use the Fluent API (Spreadsheet()) for the most modern, readable, and maintainable code.

โœจ Key Features

  • โœจ Fluent Method Chaining - Intuitive, readable code
  • ๐Ÿ“Š Multiple Formats - .xls (binary) and .xlsx (XML) support
  • ๐ŸŽจ Rich Formatting - Fonts, colors, borders, alignments
  • ๐Ÿ”ข Formula Support - Set, evaluate, and recalculate formulas
  • ๐Ÿ“ˆ Data Import/Export - JSON, CSV, Query, and Array formats
  • ๐Ÿ–ผ๏ธ Image Embedding - Add images with positioning control
  • ๐Ÿ” Password Protection - Secure spreadsheet files
  • ๐Ÿ“„ Multi-Sheet Support - Create and manage multiple worksheets
  • ๐Ÿš€ High Performance - Built on Apache POI

๐Ÿ“‹ Requirements

  • BoxLang Runtime 1.0.0 or higher
  • BoxLang+ License - This module requires a BoxLang+ license

๐Ÿ“ฆ Installation

This module requires the bx-plus module in order to unlock functionality.

Using CommandBox:

box install bx-spreadsheet

๐Ÿš€ Quick Start

Create Your First Spreadsheet

// Create a sales report with the fluent API
Spreadsheet( "sales-report.xlsx" )
    .createAndSelectSheet( "Sales Report" )
    .setRowData( 1, [ "Product", "Q1", "Q2", "Q3", "Q4", "Total" ] )
    .addRow( [ "Widget A", 1000, 1200, 1100, 1300, "=SUM(B2:E2)" ] )
    .addRow( [ "Widget B", 800, 900, 950, 1050, "=SUM(B3:E3)" ] )
    .formatRow( 1, { bold: true, fgcolor: "blue", fontColor: "white" } )
    .autoSizeColumns()
    .save();

Read an Existing Spreadsheet

// Read and convert to different formats
data = Spreadsheet( "sales-data.xlsx" ).toArray();
csvData = Spreadsheet( "report.xlsx" ).toCSV();
jsonData = Spreadsheet( "report.xlsx" ).toJson();
queryData = Spreadsheet( "report.xlsx" ).toQuery();

Using Traditional BIF Functions

// Create with BIFs
spreadsheet = SpreadsheetNew( "My Report", true );
SpreadsheetSetCellValue( spreadsheet, "Product", 1, 1 );
SpreadsheetAddRow( spreadsheet, "Widget A,29.99" );
SpreadsheetFormatRow( spreadsheet, { bold: true }, 1 );
SpreadsheetWrite( spreadsheet, "products.xlsx", true );

// Read with BIFs
data = SpreadsheetRead( "products.xlsx" );

Using Components

<!-- Create and populate -->
<bx:spreadsheet action="create" name="mySheet" sheetname="Report" />
<bx:spreadsheet action="setCellValue" name="#mySheet#" row="1" column="1" value="Name" />
<bx:spreadsheet action="addRow" name="#mySheet#" data="#['John Doe', 'Engineer']#" />
<bx:spreadsheet action="write" name="#mySheet#" filename="output.xlsx" overwrite="true" />

๐Ÿ“– Complete Documentation

For comprehensive documentation including detailed API references, advanced features, and extensive examples, visit the official documentation:

๐Ÿ“š BoxLang Spreadsheet Module Documentation

The official documentation covers:

๐Ÿ”— Additional Resources


๐Ÿ’ก Common Patterns

Creating and Formatting

// Fluent API with chaining
Spreadsheet()
    .createAndSelectSheet( "Report" )
    .setRowData( 1, [ "Name", "Age", "Salary" ] )
    .addRow( [ "John Doe", 30, 50000 ] )
    .formatRow( 1, { bold: true, fgcolor: "blue" } )
    .autoSizeColumns()
    .save( "output.xlsx" );

Working with Existing Files

// Load, modify, and save
Spreadsheet( "existing.xlsx" )
    .selectSheet( "Data" )
    .setCellValue( 2, 1, "Updated Value" )
    .setCellFormula( 2, 5, "SUM(B2:D2)" )
    .recalculateAllFormulas()
    .save();

Data Export

// Export to multiple formats
sheet = Spreadsheet( "data.xlsx" );

arrayData = sheet.toArray();         // Array of structs
queryData = sheet.toQuery();         // Query object
jsonData = sheet.toJson( true );     // Pretty JSON string
csvData = sheet.toCSV();             // CSV string

๐Ÿ’ฌ Support & Community


Built with โค๏ธ by Ortus Solutions

Professional Services Available - Need help with BoxLang implementation, training, or consulting? Contact Ortus Solutions

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.


Unreleased

1.0.0 - 2025-10-29

  • First Release

$ box install bx-spreadsheet

No collaborators yet.
     
  • {{ getFullDate("2025-10-28T15:36:24Z") }}
  • {{ getFullDate("2025-10-29T13:49:06Z") }}
  • 28
  • 4