SpreadsheetRead
Reads a sheet from a spreadsheet file and stores it in a BoxLang spreadsheet object.
Method Signature
SpreadsheetRead(src=[any], sheet=[any], format=[any], headerrow=[any], password=[any])Arguments
src
STRING
true
The path to the spreadsheet file.
sheet
ANY
false
The name or index of the sheet to read. If not specified, reads the first sheet.
format
STRING
false
The format of the spreadsheet (not used in this implementation as format is auto-detected).
headerrow
NUMERIC
false
The row number to start reading from (1-based). Default is 1.
password
STRING
false
The password for encrypted spreadsheets.
Examples
Read a spreadsheet file:
// Read an Excel file from disk
var spreadsheet = SpreadsheetRead( src = "/path/to/file.xlsx" );
println( "Read spreadsheet with " & SpreadsheetGetColumnCount( spreadsheet ) & " columns" );Read a specific sheet from a spreadsheet:
// Read a specific sheet by name
var spreadsheet = SpreadsheetRead(
    src = "/path/to/file.xlsx",
    sheet = "Sales"
);
println( "Read sheet: Sales" );Read a spreadsheet starting from a specific row:
// Skip header rows and start reading from row 5
var spreadsheet = SpreadsheetRead(
    src = "/path/to/file.xlsx",
    sheet = 1,
    headerrow = 5
);Read an encrypted spreadsheet:
// Read password-protected spreadsheet
var spreadsheet = SpreadsheetRead(
    src = "/path/to/encrypted.xlsx",
    password = "myPassword"
);Related
- SpreadsheetNew() - Create a new spreadsheet 
- SpreadsheetReadBinary() - Read binary format files 
- SpreadsheetWrite() - Save spreadsheets 
- SpreadsheetInfo() - Get spreadsheet information 
- File Handling Guide - Working with spreadsheet files 
Last updated
Was this helpful?
