> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-+-++/modules/bx-spreadsheet/built-in-functions/spreadsheet.md).

# Spreadsheet

Work with spreadsheet files

## Method Signature

```
Spreadsheet(path=[any], sheetname=[any], xmlformat=[any])
```

### Arguments

| Argument    | Type      | Required | Description                                                                                       | Default |
| ----------- | --------- | -------- | ------------------------------------------------------------------------------------------------- | ------- |
| `path`      | `STRING`  | `false`  | The path to the spreadsheet file to load or the path where the spreadsheet file will be stored at |         |
| `sheetname` | `STRING`  | `false`  | The name of the sheet to work with (optional). Default is "Sheet1".                               |         |
| `xmlformat` | `BOOLEAN` | `false`  | Whether the spreadsheet should use XML format (.xlsx). Default is true.                           | true    |

## Examples

Work with the fluent API SpreadsheetFile class:

```js
// Using fluent API for method chaining
var sheet = new SpreadsheetFile()
    .createSheet( "Sales" )
    .addRow( [ "Date", "Amount" ] )
    .addRow( [ "2024-01-01", 1500 ] )
    .addRow( [ "2024-01-02", 2000 ] )
    .formatRow( 1, { bold = true, background = "CCCCCC" } );
```

Convert between BIF and fluent APIs:

```js
// BIF approach
var bifSheet = SpreadsheetNew();

// Fluent approach
var fluentSheet = new SpreadsheetFile();

// Both work with same operations
```

## Related

* [SpreadsheetNew()](/boxlang-+-++/modules/bx-spreadsheet/built-in-functions/spreadsheetnew.md) - Create with BIF approach
* [Fluent API Guide](https://github.com/ortus-boxlang/boxlang-docs/blob/v1.x/boxlang-framework/boxlang-plus/modules/bx-spreadsheet/api-usage.md) - Method chaining reference


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://boxlang.ortusbooks.com/boxlang-+-++/modules/bx-spreadsheet/built-in-functions/spreadsheet.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
