Package ortus.boxlang.spreadsheet
Class SpreadsheetFile
java.lang.Object
ortus.boxlang.spreadsheet.SpreadsheetFile
A fluent API for managing spreadsheet files in BoxLang using Apache POI.
 This class provides a modern, chainable interface for creating, reading, and manipulating Excel files.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final String------------------------------------------------------------------------ Constants ------------------------------------------------------------------------
- 
Constructor SummaryConstructorsConstructorDescriptionConstructor - initializes a new SpreadsheetFile instance Creates a new workbook with a default sheet named "Sheet1" and using the xlsx formatSpreadsheetFile(boolean xmlFormat) Constructor with format specificationSpreadsheetFile(boolean xmlFormat, String sheetName) Constructor with format specification and sheet name
- 
Method SummaryModifier and TypeMethodDescriptionaddAutofilter(int startRow, int startColumn, int endRow, int endColumn) Adds autofilter to a range in the active sheetaddFreezePane(int column, int row) Adds a freeze pane to the active sheetaddFreezePane(int column, int row, int endColumn, int endRow) Adds a freeze pane to the active sheet with end boundariesAdds an image to the active sheet at the specified cell positionAdds an image to the active sheet with custom anchor dimensionsAdds print gridlines to the active sheet (gridlines will print)Adds a new row with the specified data at the end of the active sheetAdds a new row with the specified data at the end of the specified sheetaddRow(ortus.boxlang.runtime.types.Array values) Adds a new row with the specified data at the end of the active sheetaddRow(ortus.boxlang.runtime.types.Array values, int row, int column, boolean insert) Adds a new row with the specified data at the specified position in the active sheetaddRows(ortus.boxlang.runtime.types.Array data) Sets all data for the active sheet from a 2D array We won't include column names by default, this means, row 1 of data will be skippedaddRows(ortus.boxlang.runtime.types.Array data, boolean includeColumnNames) Sets all data for the active sheet from a 2D arrayaddRows(ortus.boxlang.runtime.types.Array data, int row, int column, boolean insert, boolean includeColumnNames) Sets all data for the active sheet from a 2D array starting at specified row and columnaddRows(ortus.boxlang.runtime.types.Array data, int row, int column, boolean insert, boolean includeColumnNames, String sheetName) Sets all data for the active sheet from a 2D array starting at specified row and columnSets all data for the active sheet from a 2D array We won't include column names by default, this means, row 1 of data will be skippedSets all data for the active sheet from a 2D array We won't include column names by default, this means, row 1 of data will be skippedaddSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow) Adds a split pane to the active sheet with default active pane (LOWER_RIGHT)addSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, int activePane) Adds a split pane to the active sheetautoCloseOnSave(boolean autoClose) Sets whether to auto close the workbook when savingautoSizeColumn(int column) Auto-sizes a specific column in the active sheetautoSizeColumn(String sheetName, int column) Auto-sizes a specific column in the specified sheetAuto-sizes all columns in the active sheetautoSizeColumns(String sheetName) Auto-sizes all columns in the specified sheetclearCell(int row, int col) Clears the specified cell of all styles and values in the active sheetclearCellRange(int startRow, int startCol, int endRow, int endCol) Clears a range of cells of all styles and values in the active sheetclearSheet(String sheetName) Clears all data from the specified sheetvoidclose()Closes the workbook and releases resourcesCopies a sheet with a new name Creates a complete copy of the source sheet including all data, formatting, and structurecreateAndSelectSheet(String sheetName) Creates a new sheet and makes it the active sheetcreateAndSelectSheet(String sheetName, boolean overwrite) Creates a new sheet and makes it the active sheetcreateSheet(String sheetName) Creates a new sheet with the specified namecreateSheet(String sheetName, boolean overwrite) Creates a new sheet with the specified namedeleteColumn(int column) Deletes a column by clearing all cells in that columndeleteColumn(String sheetName, int column) Deletes a column by clearing all cells in that column from the specified sheetdeleteColumns(int startColumn, int endColumn) Deletes multiple columns by clearing all cells in those columnsdeleteColumns(String sheetName, int startColumn, int endColumn) Deletes multiple columns by clearing all cells in those columns from the specified sheetformatCell(int row, int col, ortus.boxlang.runtime.types.IStruct format) Formats a cell in the active sheetformatCell(String sheetName, int row, int col, ortus.boxlang.runtime.types.IStruct format) Formats a cell in the specified sheetformatCellRange(ortus.boxlang.runtime.types.IStruct format, int startRow, int startCol, int endRow, int endCol) Formats a range of cells in the active sheet with a single format structformatColumn(int column, ortus.boxlang.runtime.types.IStruct format) Formats all cells in a single column in the active sheetformatColumn(String sheetName, int column, ortus.boxlang.runtime.types.IStruct format) Formats all cells in a single column in the specified sheetformatColumns(String sheetName, String columns, ortus.boxlang.runtime.types.IStruct format) Formats multiple columns in the specified sheet Column specification format: "1,3,5" or "1-5,7-10" or combinationsformatColumns(String columns, ortus.boxlang.runtime.types.IStruct format) Formats multiple columns in the active sheet Column specification format: "1,3,5" or "1-5,7-10" or combinationsformatRow(int row, ortus.boxlang.runtime.types.IStruct format) Formats all cells in a single row in the active sheetFormats all cells in a single row in the specified sheetformatRows(String sheetName, String rows, ortus.boxlang.runtime.types.IStruct format) Formats multiple rows in the specified sheet Row specification format: "1,3,5" or "1-5,7-10" or combinationsformatRows(String rows, ortus.boxlang.runtime.types.IStruct format) Formats multiple rows in the active sheet Row specification format: "1,3,5" or "1-5,7-10" or combinationsstatic SpreadsheetFilefromArray(ortus.boxlang.runtime.types.Array data) Creates a new SpreadsheetFile from an array of structs The first struct's keys will be used as column headers in row 1 Each struct represents a data rowstatic SpreadsheetFileCreates a new SpreadsheetFile from JSON string data The JSON should be an array of objects where each object represents a row The keys of the first object will be used as column headersstatic SpreadsheetFilefromQuery(ortus.boxlang.runtime.types.Query query) Creates a new SpreadsheetFile from query-like data (array of structs) Alias for fromArray() to match the fluent API patternstatic SpreadsheetFilefromWorkbook(org.apache.poi.ss.usermodel.Workbook workbook) Creates a new SpreadsheetFile from an existing workbookortus.boxlang.runtime.types.IStructGets the currently active/selected cell in the active sheetorg.apache.poi.ss.usermodel.SheetGets the active sheetGets the name of the active sheetortus.boxlang.runtime.types.ArrayGets all comments from the active sheetortus.boxlang.runtime.types.ArrayGets all data from the active sheet as a 2D arrayortus.boxlang.runtime.types.ArraygetAllData(String sheetName) Gets all data from the specified sheet as a 2D arrayortus.boxlang.runtime.types.ArrayGets all cell formulas from the active sheet as a 2D array with each value being a struct with the following keys: - formula : The cell formula as a string - row : The row number (1-based) - column : The column number (1-based)booleanGets whether formulas automatically calculategetCellAddress(int row, int column) Gets the cell address string for a given row and column (e.g., "A1", "B5")ortus.boxlang.runtime.types.IStructgetCellComment(int row, int col) Gets a comment from a cell in the active sheetortus.boxlang.runtime.types.IStructgetCellFormat(int row, int col) Gets the formatting information of the specified cell in the active sheetgetCellFormula(int row, int col) Gets cell formula from the active sheet and a specified cellortus.boxlang.runtime.types.IStructgetCellHyperlink(int row, int column) Gets the hyperlink from a cell in the active sheetgetCellType(int row, int col) Gets the Excel cell type of the specified cell in the active sheetgetCellValue(int row, int col) Gets a cell value at the specified row and column in the active sheetgetCellValue(String sheetName, int row, int col) Gets a cell value at the specified row and column in the specified sheetintGets the number of columns in the active sheetintgetColumnCount(String sheetName) Gets the number of columns in the specified sheetortus.boxlang.runtime.types.ArrayGets the column names for the active sheet.ortus.boxlang.runtime.types.ArraygetColumnNames(String sheetName) Gets the column names for the specified sheet.ortus.boxlang.runtime.types.ArrayGets the column types for the active sheet by analyzing the data in the second row (assuming first row is headers).ortus.boxlang.runtime.types.ArraygetColumnTypes(String sheetName) Gets the column types for the specified sheet by analyzing the data in the second row (assuming first row is headers).doublegetColumnWidth(int column) Gets the width of a column in the active sheet (defaults to pixels).doublegetColumnWidth(int column, boolean returnWidthInPixels) Gets the width of a column in the active sheet.ortus.boxlang.runtime.types.ArrayGets data from the active sheet as an array of structs (first row as headers)ortus.boxlang.runtime.types.ArraygetDataAsQuery(String sheetName) Gets data from the specified sheet as an array of structs (first row as headers)intGets the last row number with data in the active sheet.org.apache.poi.ss.usermodel.SheetgetOrCreateSheet(String sheetName) Get a sheet by name or create it if it doesn't existgetPath()Gets the file pathGets the print orientation of the active sheet.booleanGets whether formulas will be recalculated when the file is openedintGets the number of rows in the active sheetintgetRowCount(String sheetName) Gets the number of rows in the specified sheetortus.boxlang.runtime.types.ArraygetRowData(int row) Gets all cell values from a rowortus.boxlang.runtime.types.ArraygetRowData(String sheetName, int row) Gets all cell values from a row in the specified sheetorg.apache.poi.ss.usermodel.SheetGet a sheet by nameintGets the number of sheets in the workbookortus.boxlang.runtime.types.ArrayGets all sheet namesortus.boxlang.runtime.types.IStructGet all the sheet visibility information as a Structorg.apache.poi.ss.usermodel.WorkbookGets the underlying Apache POI workbookgroupColumns(int startColumn, int endColumn) Groups columns together in the active sheet (expanded by default)groupColumns(int startColumn, int endColumn, Boolean isCollapsed) Groups columns together in the active sheet for outline/collapse functionalitygroupRows(int startRow, int endRow) Groups rows together in the active sheet (expanded by default)Groups rows together in the active sheet for outline/collapse functionalitybooleanChecks if a sheet existshideColumn(int column) Hides a column on the active sheet (fluent API)hideRow(int row) Hides a row on the active sheet (fluent API)Hides a sheet from viewortus.boxlang.runtime.types.IStructinfo()Returns properties of a spreadsheet as a struct.booleanIs auto close on save enabledbooleanGets whether the spreadsheet is in binary format (.xls)booleanisClosed()Checks if the workbook has been closedbooleanisColumnHidden(int column) Gets the hidden state of a column on the active sheetbooleanGets whether overwrite is enabledbooleanisRowHidden(int row) Gets the hidden state of a row on the active sheetbooleanChecks if the workbook is in XML format (.xlsx)Loads a spreadsheet file from the specified pathLoads a spreadsheet file from the specified path with optional passwordmergeCells(int startRow, int startColumn, int endRow, int endColumn) Merges cells in the active sheetmoveSheet(int fromIndex, int toIndex) Moves a sheet to a new position by indexMoves a sheet to a new position by nameoverwrite(boolean overwrite) Sets whether to overwrite existing files when savingStream rows from a specific sheet in a spreadsheet file on disk using true streaming.Stream rows from a spreadsheet file on disk using true streaming (memory efficient).Stream rows from the currently-loaded workbook (this.workbook).Recalculates all formulas in the workbookremoveColumnBreak(int column) Removes a page (column) break at the specified 1-based column index on the active sheet.Removes print gridlines from the active sheet (gridlines will not print)voidremoveRow(int rowIndex) Removes a row from the active sheetremoveRowBreak(int row) Removes a page (row) break at the specified 1-based row index on the active sheet.removeSheet(int sheetNumber) Removes a sheet by number (1-based index)removeSheet(String sheetName) Removes a sheet by namerenameSheet(String oldName, String newName) Renames an existing sheetsave()Saves the spreadsheet to the currently loaded pathSaves the spreadsheet to the specified pathSaves the spreadsheet to the specified path with password protectionSaves the spreadsheet to the currently loaded path and closes the workbooksaveAndClose(String path) Saves the spreadsheet to the currently loaded path and closes the workbooksaveAndClose(String path, String password) Saves the spreadsheet to the specified path with password protection and closes the workbookselectSheet(int sheetIndex) Selects (activates) a sheet by index (1-based)selectSheet(String sheetName) Selects (activates) a sheet by namesetActiveCell(int row, int col) Sets the active/selected cell in the active sheetsetAutoCalculate(boolean autoCalculate) Sets whether formulas automatically calculatesetCellComment(int row, int col, String comment) Sets a comment on a cell in the active sheetsetCellComment(int row, int col, String comment, String author) Sets a comment on a cell in the active sheet with an authorsetCellComment(int row, int col, ortus.boxlang.runtime.types.IStruct commentStruct) Sets a comment on a cell in the active sheet from a struct with formatting optionssetCellFormula(int row, int col, String formula) Sets cell formula in the active sheetsetCellHyperlink(int row, int column, String hyperlink) Sets a hyperlink on a cell in the active sheet (without a custom label)setCellHyperlink(int row, int column, String hyperlink, String label) Sets a hyperlink on a cell in the active sheetsetCellRangeValue(Object value, int startRow, int startCol, int endRow, int endCol) Sets the same value to a range of cells in the active sheetsetCellValue(int row, int col, Object value) Sets a cell value at the specified row and column in the active sheetsetCellValue(String sheetName, int row, int col, Object value) Sets a cell value at the specified row and column in the specified sheetsetColumnBreak(int column) Sets a page (column) break at the specified 1-based column index on the active sheet.setColumnHidden(int column, boolean hidden) Sets the hidden state of a column on the active sheetsetColumnWidth(int column, double width) Sets the width of a column in the active sheetsetFitToPage(boolean fitToPage, int pagesWide, int pagesHigh) Sets the fit-to-page print option for the active sheetsetFooter(ortus.boxlang.runtime.types.IStruct footer) Sets the footer for the active sheet using a struct with optional keys: left, center, rightsetFooterImage(String alignment, String imagePath) Sets an image in the footer of the active sheetsetHeader(ortus.boxlang.runtime.types.IStruct header) Sets the header for the active sheet using a struct with optional keys: left, center, rightsetHeaderImage(String alignment, String imagePath) Sets an image in the header of the active sheetsetInfo(ortus.boxlang.runtime.types.IStruct properties) Sets document properties/metadata for the workbook (alias for addInfo)Sets the file path for this spreadsheetsetRecalculateFormulasOnNextOpen(boolean recalculate) Sets whether formulas should be recalculated when the file is openedsetRepeatingColumns(int startCol, int endCol) Sets columns to repeat on every printed page for the active sheetsetRepeatingRows(int startRow, int endRow) Sets rows to repeat on every printed page for the active sheetsetRowBreak(int row) Sets a page (row) break at the specified 1-based row index on the active sheet.setRowData(int row, ortus.boxlang.runtime.types.Array values) Sets multiple cell values from a row of datasetRowData(String sheetName, int row, ortus.boxlang.runtime.types.Array values) Sets multiple cell values from a row of data in the specified sheetsetRowHeight(int row, double height) Sets the height of a row in the active sheetsetRowHidden(int row, boolean hidden) Sets the hidden state of a row on the active sheetsetSheetPrintOrientation(String orientation) Sets the print orientation for the active sheetshiftColumns(int start) Shifts columns left or right in the active sheet (single column, default shift right by 1)shiftColumns(int start, int n) Shifts columns left or right in the active sheet (single column with shift amount)shiftColumns(int start, int end, int n) Shifts columns left or right in the active sheetshiftRows(int start) Shifts rows up or down in the active sheet (single row, default shift down by 1)shiftRows(int start, int n) Shifts rows up or down in the active sheet (single row with shift amount)shiftRows(int start, int end, int n) Shifts rows up or down in the active sheetshowColumn(int column) Shows a hidden column on the active sheet (fluent API)showRow(int row) Shows a hidden row on the active sheet (fluent API)ortus.boxlang.runtime.types.ArraytoArray()Converts the active sheet data to an array of structs (first row as headers) Alias for getDataAsQuery() to match the fluent API patternortus.boxlang.runtime.types.ArrayConverts the specified sheet data to an array of structs (first row as headers) Alias for getDataAsQuery() to match the fluent API patterntoCSV()Converts the active sheet data to CSV format with default options Default options: comma delimiter, includes headers, CRLF line separatorConverts the specified sheet data to CSV format with default optionsConverts the specified sheet data to CSV format with custom optionstoCSV(ortus.boxlang.runtime.types.IStruct options) Converts the active sheet data to CSV format with custom optionstoJson()Converts the active sheet data to JSON stringtoJson(boolean pretty) Converts the active sheet data to JSON stringConverts the specified sheet data to JSON stringortus.boxlang.runtime.types.ArraytoMatrix()Converts the active sheet data to a 2D array matrix (including headers) Returns all rows including the header row as arraysortus.boxlang.runtime.types.ArrayConverts the specified sheet data to a 2D array matrix (including headers) Returns all rows including the header row as arraysortus.boxlang.runtime.types.ArraytoQuery()Converts the active sheet data to query format (array of structs with first row as headers) Alias for getDataAsQuery() to match the fluent API patternortus.boxlang.runtime.types.ArrayConverts the specified sheet data to query format (array of structs with first row as headers) Alias for getDataAsQuery() to match the fluent API patterntoString()String representation of the spreadsheet fileungroupColumns(int startColumn, int endColumn) Ungroups columns in the active sheetungroupRows(int startRow, int endRow) Ungroups rows in the active sheetunhideSheet(String sheetName) Unhides a sheet to make it visiblestatic SpreadsheetFilexls()Creates a new SpreadsheetFile with .xls formatstatic SpreadsheetFilexlsx()Creates a new SpreadsheetFile with .xlsx format
- 
Field Details- 
DEFAULT_SHEET_NAME------------------------------------------------------------------------ Constants ------------------------------------------------------------------------- See Also:
 
 
- 
- 
Constructor Details- 
SpreadsheetFilepublic SpreadsheetFile()Constructor - initializes a new SpreadsheetFile instance Creates a new workbook with a default sheet named "Sheet1" and using the xlsx format
- 
SpreadsheetFilepublic SpreadsheetFile(boolean xmlFormat) Constructor with format specification- Parameters:
- xmlFormat- True for .xlsx format, false for .xls format
 
- 
SpreadsheetFileConstructor with format specification and sheet name- Parameters:
- xmlFormat- True for .xlsx format, false for .xls format
- sheetName- The name of the initial sheet
 
 
- 
- 
Method Details- 
fromWorkbookCreates a new SpreadsheetFile from an existing workbook- Parameters:
- workbook- The Apache POI workbook
- Returns:
- A new SpreadsheetFile instance
 
- 
xlsxCreates a new SpreadsheetFile with .xlsx format- Returns:
- A new SpreadsheetFile instance in XML format
 
- 
xlsCreates a new SpreadsheetFile with .xls format- Returns:
- A new SpreadsheetFile instance in binary format
 
- 
fromJsonCreates a new SpreadsheetFile from JSON string data The JSON should be an array of objects where each object represents a row The keys of the first object will be used as column headers- Parameters:
- json- JSON string containing array of objects
- Returns:
- A new SpreadsheetFile instance populated with the data
 
- 
fromArrayCreates a new SpreadsheetFile from an array of structs The first struct's keys will be used as column headers in row 1 Each struct represents a data row- Parameters:
- data- Array of structs where each struct is a row
- Returns:
- A new SpreadsheetFile instance populated with the data
 
- 
fromQueryCreates a new SpreadsheetFile from query-like data (array of structs) Alias for fromArray() to match the fluent API pattern- Parameters:
- query- A BoxLang query
- Returns:
- A new SpreadsheetFile instance populated with the data
 
- 
loadLoads a spreadsheet file from the specified path- Parameters:
- path- A fully qualified path to a spreadsheet file
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
loadLoads a spreadsheet file from the specified path with optional password- Parameters:
- path- A fully qualified path to a spreadsheet file
- password- Optional password for encrypted files
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
saveSaves the spreadsheet to the currently loaded path- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
saveAndCloseSaves the spreadsheet to the currently loaded path and closes the workbook- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
saveSaves the spreadsheet to the specified path- Parameters:
- path- The path to save the file
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
saveAndCloseSaves the spreadsheet to the currently loaded path and closes the workbook- Parameters:
- path- The path to save the file
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
saveSaves the spreadsheet to the specified path with password protection- Parameters:
- path- The path to save the file
- password- The password to protect the file with
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
saveAndCloseSaves the spreadsheet to the specified path with password protection and closes the workbook- Parameters:
- path- The path to save the file
- password- The password to protect the file with
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
overwriteSets whether to overwrite existing files when saving- Parameters:
- overwrite- True to overwrite existing files, false otherwise
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
autoCloseOnSaveSets whether to auto close the workbook when saving- Parameters:
- autoClose- True to auto close on save, false otherwise
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
isAutoCloseOnSavepublic boolean isAutoCloseOnSave()Is auto close on save enabled
- 
setPathSets the file path for this spreadsheet- Parameters:
- path- The file path
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
createSheetCreates a new sheet with the specified name- Parameters:
- sheetName- The name of the new sheet
- overwrite- Whether to overwrite an existing sheet with the same name
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
createSheetCreates a new sheet with the specified name- Parameters:
- sheetName- The name of the new sheet
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
createAndSelectSheetCreates a new sheet and makes it the active sheet- Parameters:
- sheetName- The name of the new sheet
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
createAndSelectSheetCreates a new sheet and makes it the active sheet- Parameters:
- sheetName- The name of the new sheet
- overwrite- Whether to overwrite an existing sheet with the same name
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
selectSheetSelects (activates) a sheet by name- Parameters:
- sheetName- The name of the sheet to activate
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
selectSheetSelects (activates) a sheet by index (1-based)- Parameters:
- sheetIndex- The index of the sheet to activate (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
removeSheetRemoves a sheet by name- Parameters:
- sheetName- The name of the sheet to remove
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
removeSheetRemoves a sheet by number (1-based index)- Parameters:
- sheetNumber- The sheet number to remove (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
renameSheetRenames an existing sheet- Parameters:
- oldName- The current name of the sheet
- newName- The new name for the sheet
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
copySheetCopies a sheet with a new name Creates a complete copy of the source sheet including all data, formatting, and structure- Parameters:
- fromName- The name of the sheet to copy from
- toName- The name of the new sheet
- Returns:
- This SpreadsheetFile instance for method chaining
- Throws:
- ortus.boxlang.runtime.types.exceptions.BoxRuntimeException- if the source sheet doesn't exist or target sheet already exists
 
- 
hideSheetHides a sheet from view- Parameters:
- sheetName- The name of the sheet to hide
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
unhideSheetUnhides a sheet to make it visible- Parameters:
- sheetName- The name of the sheet to unhide
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
moveSheetMoves a sheet to a new position by index- Parameters:
- fromIndex- The current sheet index (0-based)
- toIndex- The target sheet index (0-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
moveSheetMoves a sheet to a new position by name- Parameters:
- sheetName- The name of the sheet to move
- toIndex- The target sheet index (0-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
getCellAddressGets the cell address string for a given row and column (e.g., "A1", "B5")- Parameters:
- row- The row number (1-based)
- column- The column number (1-based)
- Returns:
- The cell address string
 
- 
infopublic ortus.boxlang.runtime.types.IStruct info()Returns properties of a spreadsheet as a struct.- Returns:
- A struct containing sheet properties
 
- 
recalculateAllFormulasRecalculates all formulas in the workbook- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
setCellValueSets a cell value at the specified row and column in the active sheet- Parameters:
- row- The row number (1-based)
- col- The column number (1-based)
- value- The value to set
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
setCellValueSets a cell value at the specified row and column in the specified sheet- Parameters:
- sheetName- The name of the sheet
- row- The row number (1-based)
- col- The column number (1-based)
- value- The value to set
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
getCellValueGets a cell value at the specified row and column in the active sheet- Parameters:
- row- The row number (1-based)
- col- The column number (1-based)
- Returns:
- The cell value
 
- 
getCellValueGets a cell value at the specified row and column in the specified sheet- Parameters:
- sheetName- The name of the sheet
- row- The row number (1-based)
- col- The column number (1-based)
- Returns:
- The cell value
 
- 
formatCellFormats a cell in the active sheet- Parameters:
- row- The row number (1-based)
- col- The column number (1-based)
- format- A structure containing formatting options
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
formatCellpublic SpreadsheetFile formatCell(String sheetName, int row, int col, ortus.boxlang.runtime.types.IStruct format) Formats a cell in the specified sheet- Parameters:
- sheetName- The name of the sheet
- row- The row number (1-based)
- col- The column number (1-based)
- format- A structure containing formatting options
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
formatRowFormats all cells in a single row in the active sheet- Parameters:
- row- The row number (1-based)
- format- A structure containing formatting options
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
formatRowpublic SpreadsheetFile formatRow(String sheetName, int row, ortus.boxlang.runtime.types.IStruct format) Formats all cells in a single row in the specified sheet- Parameters:
- sheetName- The name of the sheet
- row- The row number (1-based)
- format- A structure containing formatting options
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
formatRowsFormats multiple rows in the active sheet Row specification format: "1,3,5" or "1-5,7-10" or combinations- Parameters:
- rows- A string specifying which rows to format
- format- A structure containing formatting options
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
formatRowspublic SpreadsheetFile formatRows(String sheetName, String rows, ortus.boxlang.runtime.types.IStruct format) Formats multiple rows in the specified sheet Row specification format: "1,3,5" or "1-5,7-10" or combinations- Parameters:
- sheetName- The name of the sheet
- rows- A string specifying which rows to format
- format- A structure containing formatting options
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
formatColumnFormats all cells in a single column in the active sheet- Parameters:
- column- The column number (1-based)
- format- A structure containing formatting options
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
formatColumnpublic SpreadsheetFile formatColumn(String sheetName, int column, ortus.boxlang.runtime.types.IStruct format) Formats all cells in a single column in the specified sheet- Parameters:
- sheetName- The name of the sheet
- column- The column number (1-based)
- format- A structure containing formatting options
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
formatColumnsFormats multiple columns in the active sheet Column specification format: "1,3,5" or "1-5,7-10" or combinations- Parameters:
- columns- A string specifying which columns to format
- format- A structure containing formatting options
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
formatColumnspublic SpreadsheetFile formatColumns(String sheetName, String columns, ortus.boxlang.runtime.types.IStruct format) Formats multiple columns in the specified sheet Column specification format: "1,3,5" or "1-5,7-10" or combinations- Parameters:
- sheetName- The name of the sheet
- columns- A string specifying which columns to format
- format- A structure containing formatting options
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
setRowDataSets multiple cell values from a row of data- Parameters:
- row- The row number (1-based)
- values- Array of values to set starting from column 1
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
setRowDatapublic SpreadsheetFile setRowData(String sheetName, int row, ortus.boxlang.runtime.types.Array values) Sets multiple cell values from a row of data in the specified sheet- Parameters:
- sheetName- The name of the sheet
- row- The row number (1-based)
- values- Array of values to set starting from column 1
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
getRowDatapublic ortus.boxlang.runtime.types.Array getRowData(int row) Gets all cell values from a row- Parameters:
- row- The row number (1-based)
- Returns:
- Array of cell values
 
- 
getRowDataGets all cell values from a row in the specified sheet- Parameters:
- sheetName- The name of the sheet
- row- The row number (1-based)
- Returns:
- Array of cell values
 
- 
addRowAdds a new row with the specified data at the end of the active sheet- Parameters:
- values- Comma-separated string of values to add as a new row
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
addRowAdds a new row with the specified data at the end of the active sheet- Parameters:
- values- Array of values to add as a new row
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
processpublic SpreadsheetFile process(String path, Consumer<ortus.boxlang.runtime.types.Array> rowConsumer) Stream rows from a spreadsheet file on disk using true streaming (memory efficient). This uses the excel-streaming-reader library for memory-efficient processing of large files. Rows are provided as a BoxLang Array where each element is the typed value of the cell (String, Double, Boolean, Date, or null).- Parameters:
- path- Absolute path to the spreadsheet file to process
- rowConsumer- Consumer that receives each row as a BoxLang Array
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
processpublic SpreadsheetFile process(String path, String sheetName, Consumer<ortus.boxlang.runtime.types.Array> rowConsumer) Stream rows from a specific sheet in a spreadsheet file on disk using true streaming. This uses the excel-streaming-reader library for memory-efficient processing of large files.- Parameters:
- path- Absolute path to the spreadsheet file to process
- sheetName- Name of the sheet to process (null for first sheet)
- rowConsumer- Consumer that receives each row as a BoxLang Array
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
processStream rows from the currently-loaded workbook (this.workbook). If no workbook is loaded, but a path is set, the file will be read and processed using streaming. Throws if neither is available.- Parameters:
- rowConsumer- Consumer that receives each row as a BoxLang Array
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
addRowpublic SpreadsheetFile addRow(ortus.boxlang.runtime.types.Array values, int row, int column, boolean insert) Adds a new row with the specified data at the specified position in the active sheet- Parameters:
- values- Array of values to add as a new row
- row- The row number (1-based) to insert the new row at
- column- The starting column number (1-based) for the new row
- insert- Whether to insert the row (shifting existing rows down) or overwrite
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
addRowAdds a new row with the specified data at the end of the specified sheet- Parameters:
- sheetName- The name of the sheet
- values- Array of values to add as a new row
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
getAllDatapublic ortus.boxlang.runtime.types.Array getAllData()Gets all data from the active sheet as a 2D array- Returns:
- Array of arrays representing the sheet data
 
- 
getAllDataGets all data from the specified sheet as a 2D array- Parameters:
- sheetName- The name of the sheet
- Returns:
- Array of arrays representing the sheet data
 
- 
removeRowpublic void removeRow(int rowIndex) Removes a row from the active sheet- Parameters:
- rowIndex- The row number to remove (1-based)
 
- 
deleteColumnDeletes a column by clearing all cells in that column- Parameters:
- column- The column number to delete (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
deleteColumnDeletes a column by clearing all cells in that column from the specified sheet- Parameters:
- sheetName- The name of the sheet
- column- The column number to delete (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
deleteColumnsDeletes multiple columns by clearing all cells in those columns- Parameters:
- startColumn- The starting column number (1-based, inclusive)
- endColumn- The ending column number (1-based, inclusive)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
deleteColumnsDeletes multiple columns by clearing all cells in those columns from the specified sheet- Parameters:
- sheetName- The name of the sheet
- startColumn- The starting column number (1-based, inclusive)
- endColumn- The ending column number (1-based, inclusive)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
addRowsSets all data for the active sheet from a 2D array We won't include column names by default, this means, row 1 of data will be skipped- Parameters:
- data- Array of arrays representing the sheet data
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
addRowsSets all data for the active sheet from a 2D array We won't include column names by default, this means, row 1 of data will be skipped- Parameters:
- data- Array of arrays representing the sheet data
- sheetName- The name of the sheet to set data in, it can be a new or existing sheet
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
addRowspublic SpreadsheetFile addRows(ortus.boxlang.runtime.types.Array data, String sheetName, boolean includeColumnNames) Sets all data for the active sheet from a 2D array We won't include column names by default, this means, row 1 of data will be skipped- Parameters:
- data- Array of arrays representing the sheet data
- sheetName- The name of the sheet to set data in, it can be a new or existing sheet
- includeColumnNames- Whether the first row of data includes column names, and should be inserted at the top
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
addRowsSets all data for the active sheet from a 2D array- Parameters:
- data- Array of arrays representing the sheet data
- includeColumnNames- Whether the first row of data includes column names, and should be inserted at the top
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
addRowspublic SpreadsheetFile addRows(ortus.boxlang.runtime.types.Array data, int row, int column, boolean insert, boolean includeColumnNames) Sets all data for the active sheet from a 2D array starting at specified row and column- Parameters:
- data- Array of arrays representing the sheet data
- row- The starting row number (1-based)
- column- The starting column number (1-based)
- insert- Whether to insert rows (shifting existing rows down) or overwrite
- includeColumnNames- Whether the first row of data includes column names, and should be inserted at the top
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
addRowspublic SpreadsheetFile addRows(ortus.boxlang.runtime.types.Array data, int row, int column, boolean insert, boolean includeColumnNames, String sheetName) Sets all data for the active sheet from a 2D array starting at specified row and column- Parameters:
- data- Array of arrays representing the sheet data
- row- The starting row number (1-based)
- column- The starting column number (1-based)
- insert- Whether to insert rows (shifting existing rows down) or overwrite
- includeColumnNames- Whether the first row of data includes column names, and should be inserted at the top
- sheetName- The name of the sheet to set data in, it can be a new or existing sheet
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
getDataAsQuerypublic ortus.boxlang.runtime.types.Array getDataAsQuery()Gets data from the active sheet as an array of structs (first row as headers)- Returns:
- Array of structs where keys are column headers
 
- 
getDataAsQueryGets data from the specified sheet as an array of structs (first row as headers)- Parameters:
- sheetName- The name of the sheet
- Returns:
- Array of structs where keys are column headers
 
- 
toArraypublic ortus.boxlang.runtime.types.Array toArray()Converts the active sheet data to an array of structs (first row as headers) Alias for getDataAsQuery() to match the fluent API pattern- Returns:
- Array of structs where keys are column headers
 
- 
toArrayConverts the specified sheet data to an array of structs (first row as headers) Alias for getDataAsQuery() to match the fluent API pattern- Parameters:
- sheetName- The name of the sheet
- Returns:
- Array of structs where keys are column headers
 
- 
toQuerypublic ortus.boxlang.runtime.types.Array toQuery()Converts the active sheet data to query format (array of structs with first row as headers) Alias for getDataAsQuery() to match the fluent API pattern- Returns:
- Array of structs where keys are column headers
 
- 
toQueryConverts the specified sheet data to query format (array of structs with first row as headers) Alias for getDataAsQuery() to match the fluent API pattern- Parameters:
- sheetName- The name of the sheet
- Returns:
- Array of structs where keys are column headers
 
- 
toJsonConverts the active sheet data to JSON string- Returns:
- JSON string representation of the sheet data
 
- 
toJsonConverts the active sheet data to JSON string- Parameters:
- pretty- Whether to pretty-print the JSON output
- Returns:
- JSON string representation of the sheet data
 
- 
toJsonConverts the specified sheet data to JSON string- Parameters:
- sheetName- The name of the sheet
- Returns:
- JSON string representation of the sheet data
 
- 
toMatrixpublic ortus.boxlang.runtime.types.Array toMatrix()Converts the active sheet data to a 2D array matrix (including headers) Returns all rows including the header row as arrays- Returns:
- Array of arrays representing the sheet data as a matrix
 
- 
toMatrixConverts the specified sheet data to a 2D array matrix (including headers) Returns all rows including the header row as arrays- Parameters:
- sheetName- The name of the sheet to convert
- Returns:
- Array of arrays representing the sheet data as a matrix
 
- 
toCSVConverts the active sheet data to CSV format with default options Default options: comma delimiter, includes headers, CRLF line separator- Returns:
- CSV string representation of the sheet data
 
- 
toCSVConverts the active sheet data to CSV format with custom options- Parameters:
- options- A struct containing CSV options: - delimiter (String): The delimiter to use between values (default: ",") - includeHeaders (Boolean): Whether to include the header row (default: true) - lineSeparator (String): The line separator to use (default: "\r\n")
- Returns:
- CSV string representation of the sheet data
 
- 
toCSVConverts the specified sheet data to CSV format with default options- Parameters:
- sheetName- The name of the sheet to convert
- Returns:
- CSV string representation of the sheet data
 
- 
toCSVConverts the specified sheet data to CSV format with custom options- Parameters:
- sheetName- The name of the sheet to convert
- options- A struct containing CSV options: - delimiter (String): The delimiter to use between values (default: ",") - includeHeaders (Boolean): Whether to include the header row (default: true) - lineSeparator (String): The line separator to use (default: "\r\n")
- Returns:
- CSV string representation of the sheet data
 
- 
autoSizeColumnsAuto-sizes all columns in the active sheet- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
autoSizeColumnsAuto-sizes all columns in the specified sheet- Parameters:
- sheetName- The name of the sheet
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
autoSizeColumnAuto-sizes a specific column in the active sheet- Parameters:
- column- The column number (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
autoSizeColumnAuto-sizes a specific column in the specified sheet- Parameters:
- sheetName- The name of the sheet
- column- The column number (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
getPathGets the file path- Returns:
- The file path
 
- 
getWorkbookpublic org.apache.poi.ss.usermodel.Workbook getWorkbook()Gets the underlying Apache POI workbook- Returns:
- The workbook instance
 
- 
getActiveSheetpublic org.apache.poi.ss.usermodel.Sheet getActiveSheet()Gets the active sheet- Returns:
- The active sheet
 
- 
getSheetGet a sheet by name- Parameters:
- sheetName- The name of the sheet
- Returns:
- The sheet instance or null if not found
 
- 
getOrCreateSheetGet a sheet by name or create it if it doesn't exist- Parameters:
- sheetName- The name of the sheet
 
- 
getActiveSheetNameGets the name of the active sheet- Returns:
- The active sheet name
 
- 
getSheetCountpublic int getSheetCount()Gets the number of sheets in the workbook- Returns:
- The number of sheets
 
- 
getSheetNamespublic ortus.boxlang.runtime.types.Array getSheetNames()Gets all sheet names- Returns:
- Array of sheet names
 
- 
getSheetsVisibilitypublic ortus.boxlang.runtime.types.IStruct getSheetsVisibility()Get all the sheet visibility information as a Struct- Returns:
- A struct with sheet names as keys and visibility status as values
 
- 
hasSheetChecks if a sheet exists- Parameters:
- sheetName- The name of the sheet
- Returns:
- True if the sheet exists, false otherwise
 
- 
getRowCountpublic int getRowCount()Gets the number of rows in the active sheet- Returns:
- The number of rows
 
- 
getRowCountGets the number of rows in the specified sheet- Parameters:
- sheetName- The name of the sheet
- Returns:
- The number of rows
 
- 
getColumnCountpublic int getColumnCount()Gets the number of columns in the active sheet- Returns:
- The number of columns
 
- 
getColumnNamespublic ortus.boxlang.runtime.types.Array getColumnNames()Gets the column names for the active sheet. If the first row contains data, it returns those values as column names. If no data is present in the first row, returns Excel-style column identifiers (A, B, C, etc.)- Returns:
- Array of column names or Excel column identifiers
 
- 
getColumnTypespublic ortus.boxlang.runtime.types.Array getColumnTypes()Gets the column types for the active sheet by analyzing the data in the second row (assuming first row is headers). Returns array of type strings: "string", "numeric", or "date"- Returns:
- Array of column type strings ("string", "numeric", "date")
 
- 
getColumnCountGets the number of columns in the specified sheet- Parameters:
- sheetName- The name of the sheet
- Returns:
- The number of columns
 
- 
getColumnNamesGets the column names for the specified sheet. If the first row contains data, it returns those values as column names. If no data is present in the first row, returns Excel-style column identifiers (A, B, C, etc.)- Parameters:
- sheetName- The name of the sheet
- Returns:
- Array of column names or Excel column identifiers
 
- 
getColumnTypesGets the column types for the specified sheet by analyzing the data in the second row (assuming first row is headers). Returns array of type strings: "string", "numeric", or "date"- Parameters:
- sheetName- The name of the sheet
- Returns:
- Array of column type strings ("string", "numeric", "date")
 
- 
isXmlFormatpublic boolean isXmlFormat()Checks if the workbook is in XML format (.xlsx)- Returns:
- True if XML format, false if binary format
 
- 
isBinaryFormatpublic boolean isBinaryFormat()Gets whether the spreadsheet is in binary format (.xls)- Returns:
- True if format is binary, false if XML
 
- 
isOverwriteEnabledpublic boolean isOverwriteEnabled()Gets whether overwrite is enabled- Returns:
- True if overwrite is enabled, false otherwise
 
- 
addFreezePaneAdds a freeze pane to the active sheet- Parameters:
- column- The column boundary (columns to the left are frozen)
- row- The row boundary (rows above are frozen)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
addFreezePaneAdds a freeze pane to the active sheet with end boundaries- Parameters:
- column- The column boundary (columns to the left are frozen)
- row- The row boundary (rows above are frozen)
- endColumn- End column boundary (optional)
- endRow- End row boundary (optional)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
addSplitPanepublic SpreadsheetFile addSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, int activePane) Adds a split pane to the active sheet- Parameters:
- xSplitPos- The horizontal (x-axis) position of the split in 1/20th of a pixel units
- ySplitPos- The vertical (y-axis) position of the split in 1/20th of a pixel units
- leftmostColumn- The leftmost column visible in the right pane (1-based)
- topRow- The top row visible in the bottom pane (1-based)
- activePane- The active pane (0=lower-left, 1=upper-right, 2=lower-right, 3=upper-left)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
addSplitPaneAdds a split pane to the active sheet with default active pane (LOWER_RIGHT)- Parameters:
- xSplitPos- The horizontal (x-axis) position of the split in 1/20th of a pixel units
- ySplitPos- The vertical (y-axis) position of the split in 1/20th of a pixel units
- leftmostColumn- The leftmost column visible in the right pane (1-based)
- topRow- The top row visible in the bottom pane (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
setRowBreakSets a page (row) break at the specified 1-based row index on the active sheet.- Parameters:
- row- 1-based row number
- Returns:
- this
 
- 
removeRowBreakRemoves a page (row) break at the specified 1-based row index on the active sheet.- Parameters:
- row- 1-based row number
- Returns:
- this
 
- 
setColumnBreakSets a page (column) break at the specified 1-based column index on the active sheet.- Parameters:
- column- 1-based column number
- Returns:
- this
 
- 
removeColumnBreakRemoves a page (column) break at the specified 1-based column index on the active sheet.- Parameters:
- column- 1-based column number
- Returns:
- this
 
- 
setFitToPageSets the fit-to-page print option for the active sheet- Parameters:
- fitToPage- Whether to enable fit-to-page printing
- pagesWide- Number of pages to fit the sheet's columns into (0 = no horizontal constraint)
- pagesHigh- Number of pages to fit the sheet's rows into (0 = no vertical constraint)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
addPrintGridlinesAdds print gridlines to the active sheet (gridlines will print)- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
removePrintGridlinesRemoves print gridlines from the active sheet (gridlines will not print)- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
getColumnWidthpublic double getColumnWidth(int column, boolean returnWidthInPixels) Gets the width of a column in the active sheet.- Parameters:
- column- The column number (1-based)
- returnWidthInPixels- If true, returns width in pixels; if false, returns width in points (default: true)
- Returns:
- Column width as a double value
 
- 
getColumnWidthpublic double getColumnWidth(int column) Gets the width of a column in the active sheet (defaults to pixels).- Parameters:
- column- The column number (1-based)
- Returns:
- Column width in pixels
 
- 
getLastRowNumberpublic int getLastRowNumber()Gets the last row number with data in the active sheet.- Returns:
- The last row number (1-based), or 0 if sheet is empty
 
- 
getPrintOrientationGets the print orientation of the active sheet.- Returns:
- "portrait" or "landscape"
 
- 
setColumnHiddenSets the hidden state of a column on the active sheet- Parameters:
- column- The column number (1-based)
- hidden- True to hide, false to show
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
hideColumnHides a column on the active sheet (fluent API)- Parameters:
- column- The column number (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
showColumnShows a hidden column on the active sheet (fluent API)- Parameters:
- column- The column number (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
isColumnHiddenpublic boolean isColumnHidden(int column) Gets the hidden state of a column on the active sheet- Parameters:
- column- The column number (1-based)
- Returns:
- true if hidden, false otherwise
 
- 
setRowHiddenSets the hidden state of a row on the active sheet- Parameters:
- row- The row number (1-based)
- hidden- True to hide, false to show
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
hideRowHides a row on the active sheet (fluent API)- Parameters:
- row- The row number (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
showRowShows a hidden row on the active sheet (fluent API)- Parameters:
- row- The row number (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
isRowHiddenpublic boolean isRowHidden(int row) Gets the hidden state of a row on the active sheet- Parameters:
- row- The row number (1-based)
- Returns:
- true if hidden, false otherwise
 
- 
addImageAdds an image to the active sheet at the specified cell position- Parameters:
- filepath- The absolute path to the image file (jpg, jpeg, png, or dib)
- row- The starting row (1-based)
- column- The starting column (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
addImagepublic SpreadsheetFile addImage(String filepath, int startRow, int startCol, int endRow, int endCol) Adds an image to the active sheet with custom anchor dimensions- Parameters:
- filepath- The absolute path to the image file (jpg, jpeg, png, or dib)
- startRow- The starting row (1-based)
- startCol- The starting column (1-based)
- endRow- The ending row (1-based)
- endCol- The ending column (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
setHeaderSets the header for the active sheet using a struct with optional keys: left, center, right- Parameters:
- header- The header struct
- Returns:
- This SpreadsheetFile instance for chaining
 
- 
setHeaderImageSets an image in the header of the active sheet- Parameters:
- alignment- The alignment: "left", "center", or "right"
- imagePath- The absolute path to the image file
- Returns:
- This SpreadsheetFile instance for chaining
 
- 
addAutofilterAdds autofilter to a range in the active sheet- Parameters:
- startRow- The starting row (1-based)
- startColumn- The starting column (1-based)
- endRow- The ending row (1-based)
- endColumn- The ending column (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
mergeCellsMerges cells in the active sheet- Parameters:
- startRow- The starting row (1-based)
- startColumn- The starting column (1-based)
- endRow- The ending row (1-based)
- endColumn- The ending column (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
setCellFormulaSets cell formula in the active sheet- Parameters:
- row- The row number (1-based)
- col- The column number (1-based)
- formula- The formula to set (without leading =)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
getCellFormulaGets cell formula from the active sheet and a specified cell- Parameters:
- row- The row number (1-based)
- col- The column number (1-based)
- Returns:
- The formula as a string, or null if no formula
 
- 
getAllFormulaspublic ortus.boxlang.runtime.types.Array getAllFormulas()Gets all cell formulas from the active sheet as a 2D array with each value being a struct with the following keys: - formula : The cell formula as a string - row : The row number (1-based) - column : The column number (1-based)- Returns:
- 2D Array of cell formulas (null for cells without formulas)
 
- 
setColumnWidthSets the width of a column in the active sheet- Parameters:
- column- The column number (1-based)
- width- The width in Excel units
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
setRowHeightSets the height of a row in the active sheet- Parameters:
- row- The row number (1-based)
- height- The height in points
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
shiftRowsShifts rows up or down in the active sheet- Parameters:
- start- The starting row number (1-based)
- end- The ending row number (1-based)
- n- The number of rows to shift (positive for down, negative for up)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
shiftRowsShifts rows up or down in the active sheet (single row, default shift down by 1)- Parameters:
- start- The starting row number (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
shiftRowsShifts rows up or down in the active sheet (single row with shift amount)- Parameters:
- start- The starting row number (1-based)
- n- The number of rows to shift (positive for down, negative for up)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
shiftColumnsShifts columns left or right in the active sheet- Parameters:
- start- The starting column number (1-based)
- end- The ending column number (1-based)
- n- The number of columns to shift (positive for right, negative for left)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
shiftColumnsShifts columns left or right in the active sheet (single column, default shift right by 1)- Parameters:
- start- The starting column number (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
shiftColumnsShifts columns left or right in the active sheet (single column with shift amount)- Parameters:
- start- The starting column number (1-based)
- n- The number of columns to shift (positive for right, negative for left)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
setCellCommentSets a comment on a cell in the active sheet- Parameters:
- row- The row number (1-based)
- col- The column number (1-based)
- comment- The comment text
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
setCellCommentSets a comment on a cell in the active sheet with an author- Parameters:
- row- The row number (1-based)
- col- The column number (1-based)
- comment- The comment text
- author- The comment author
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
setCellCommentpublic SpreadsheetFile setCellComment(int row, int col, ortus.boxlang.runtime.types.IStruct commentStruct) Sets a comment on a cell in the active sheet from a struct with formatting options- Parameters:
- row- The row number (1-based)
- col- The column number (1-based)
- commentStruct- A struct with comment details and formatting options
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
getCellCommentpublic ortus.boxlang.runtime.types.IStruct getCellComment(int row, int col) Gets a comment from a cell in the active sheet- Parameters:
- row- The row number (1-based)
- col- The column number (1-based)
- Returns:
- The comment as a struct with {Author, Column, Comment, Row}, or null if no comment exists
 
- 
getAllCellCommentspublic ortus.boxlang.runtime.types.Array getAllCellComments()Gets all comments from the active sheet- Returns:
- An array of structs with {Author, Column, Comment, Row} for each comment in the sheet
 
- 
setInfoSets document properties/metadata for the workbook (alias for addInfo)- Parameters:
- properties- A struct containing metadata properties (AUTHOR, TITLE, SUBJECT, COMMENTS, KEYWORDS, CATEGORY, LASTAUTHOR)
- Returns:
- this - for method chaining
 
- 
clearCellClears the specified cell of all styles and values in the active sheet- Parameters:
- row- The row number (1-based)
- col- The column number (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
clearSheetClears all data from the specified sheet- Parameters:
- sheetName- The name of the sheet to clear
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
clearCellRangeClears a range of cells of all styles and values in the active sheet- Parameters:
- startRow- The starting row (1-based, inclusive)
- startCol- The starting column (1-based, inclusive)
- endRow- The ending row (1-based, inclusive)
- endCol- The ending column (1-based, inclusive)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
getCellTypeGets the Excel cell type of the specified cell in the active sheet- Parameters:
- row- The row number (1-based)
- col- The column number (1-based)
- Returns:
- Cell type as a string: "BLANK", "BOOLEAN", "ERROR", "FORMULA", "NUMERIC", or "STRING"
 
- 
getCellFormatpublic ortus.boxlang.runtime.types.IStruct getCellFormat(int row, int col) Gets the formatting information of the specified cell in the active sheet- Parameters:
- row- The row number (1-based)
- col- The column number (1-based)
- Returns:
- A struct containing all formatting attributes of the cell
 
- 
setCellRangeValuepublic SpreadsheetFile setCellRangeValue(Object value, int startRow, int startCol, int endRow, int endCol) Sets the same value to a range of cells in the active sheet- Parameters:
- value- The value to set for all cells in the range
- startRow- The starting row (1-based)
- startCol- The starting column (1-based)
- endRow- The ending row (1-based)
- endCol- The ending column (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
getActiveCellpublic ortus.boxlang.runtime.types.IStruct getActiveCell()Gets the currently active/selected cell in the active sheet- Returns:
- A struct with keys "row" and "column" (both 1-based)
 
- 
setActiveCellSets the active/selected cell in the active sheet- Parameters:
- row- The row number (1-based)
- col- The column number (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
setCellHyperlinkSets a hyperlink on a cell in the active sheet- Parameters:
- row- The row number (1-based)
- column- The column number (1-based)
- hyperlink- The hyperlink URL
- label- The optional display label for the hyperlink
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
setCellHyperlinkSets a hyperlink on a cell in the active sheet (without a custom label)- Parameters:
- row- The row number (1-based)
- column- The column number (1-based)
- hyperlink- The hyperlink URL
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
getCellHyperlinkpublic ortus.boxlang.runtime.types.IStruct getCellHyperlink(int row, int column) Gets the hyperlink from a cell in the active sheet- Parameters:
- row- The row number (1-based)
- column- The column number (1-based)
- Returns:
- A struct containing hyperlink information (url, label, type), or null if no hyperlink exists
 
- 
formatCellRangepublic SpreadsheetFile formatCellRange(ortus.boxlang.runtime.types.IStruct format, int startRow, int startCol, int endRow, int endCol) Formats a range of cells in the active sheet with a single format struct- Parameters:
- format- The format struct containing style properties
- startRow- The starting row (1-based)
- startCol- The starting column (1-based)
- endRow- The ending row (1-based)
- endCol- The ending column (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
setSheetPrintOrientationSets the print orientation for the active sheet- Parameters:
- orientation- The orientation ("portrait" or "landscape")
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
setRepeatingColumnsSets columns to repeat on every printed page for the active sheet- Parameters:
- startCol- The starting column (1-based)
- endCol- The ending column (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
setRepeatingRowsSets rows to repeat on every printed page for the active sheet- Parameters:
- startRow- The starting row (1-based)
- endRow- The ending row (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
groupRowsGroups rows together in the active sheet for outline/collapse functionality- Parameters:
- startRow- The starting row (1-based)
- endRow- The ending row (1-based)
- isCollapsed- Whether the group should be initially collapsed (default: false)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
groupRowsGroups rows together in the active sheet (expanded by default)- Parameters:
- startRow- The starting row (1-based)
- endRow- The ending row (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
ungroupRowsUngroups rows in the active sheet- Parameters:
- startRow- The starting row (1-based)
- endRow- The ending row (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
groupColumnsGroups columns together in the active sheet for outline/collapse functionality- Parameters:
- startColumn- The starting column (1-based)
- endColumn- The ending column (1-based)
- isCollapsed- Whether the group should be initially collapsed (default: false)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
groupColumnsGroups columns together in the active sheet (expanded by default)- Parameters:
- startColumn- The starting column (1-based)
- endColumn- The ending column (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
ungroupColumnsUngroups columns in the active sheet- Parameters:
- startColumn- The starting column (1-based)
- endColumn- The ending column (1-based)
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
getAutoCalculatepublic boolean getAutoCalculate()Gets whether formulas automatically calculate- Returns:
- True if auto-calculation is enabled, false otherwise
 
- 
setAutoCalculateSets whether formulas automatically calculate- Parameters:
- autoCalculate- Whether to enable auto-calculation
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
getRecalculateFormulasOnNextOpenpublic boolean getRecalculateFormulasOnNextOpen()Gets whether formulas will be recalculated when the file is opened- Returns:
- True if force recalculation is enabled, false otherwise
 
- 
setRecalculateFormulasOnNextOpenSets whether formulas should be recalculated when the file is opened- Parameters:
- recalculate- Whether to force recalculation on next open
- Returns:
- This SpreadsheetFile instance for method chaining
 
- 
closepublic void close()Closes the workbook and releases resources
- 
isClosedpublic boolean isClosed()Checks if the workbook has been closed- Returns:
- true if closed, false otherwise
 
- 
toStringString representation of the spreadsheet file
 
-