> 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/spreadsheetaddrow.md).

# SpreadsheetAddRow

Adds a row to an Excel spreadsheet object.

## Method Signature

```
SpreadsheetAddRow(spreadsheetObj=[any], data=[any], row=[any], column=[any], insert=[any])
```

### Arguments

| Argument         | Type      | Required | Description                                                                                     | Default |
| ---------------- | --------- | -------- | ----------------------------------------------------------------------------------------------- | ------- |
| `spreadsheetObj` | `ANY`     | `true`   | The spreadsheet object.                                                                         |         |
| `data`           | `ANY`     | `true`   | An array of data to add to the row, or a comma delimited string of cell entries, one per column |         |
| `row`            | `NUMERIC` | `false`  | The row number where to insert the data (1-based). If not specified, adds to the end.           |         |
| `column`         | `NUMERIC` | `false`  | The column number where to start inserting the data (1-based). Default is 1.                    |         |
| `insert`         | `BOOLEAN` | `false`  | Whether to insert a new row or overwrite existing row. Default is false.                        | true    |

## Examples

Add a row with array data:

```js
// Add a row of data as an array
var spreadsheet = SpreadsheetNew();
var rowData = [ "John", "Sales", 75000 ];
SpreadsheetAddRow( spreadsheet, rowData );
println( "Row added to spreadsheet" );
```

Add a row to the end:

```js
// Append rows to existing spreadsheet
var spreadsheet = SpreadsheetRead( "/path/to/file.xlsx" );
SpreadsheetAddRow( spreadsheet, [ "Alice", "Marketing", 65000 ] );
SpreadsheetAddRow( spreadsheet, [ "Bob", "IT", 80000 ] );
```

Insert a row at a specific position:

```js
// Insert a row without overwriting
var spreadsheet = SpreadsheetNew();
SpreadsheetAddRow( spreadsheet, [ "Header1", "Header2", "Header3" ] );
SpreadsheetAddRow( spreadsheet, [ "Data1", "Data2", "Data3" ] );

// Insert a new row at position 2 (shifts existing rows down)
SpreadsheetAddRow( spreadsheet, [ "New", "Row", "Data" ], row = 2, insert = true );
```

Add comma-delimited data:

```js
// Add row using comma-delimited string
var spreadsheet = SpreadsheetNew();
SpreadsheetAddRow( spreadsheet, "John,Doe,john@example.com" );
SpreadsheetAddRow( spreadsheet, "Jane,Smith,jane@example.com" );
```

## Related

* [SpreadsheetAddRows()](/boxlang-+-++/modules/bx-spreadsheet/built-in-functions/spreadsheetaddrows.md) - Add multiple rows at once
* [SpreadsheetDeleteRow()](/boxlang-+-++/modules/bx-spreadsheet/built-in-functions/spreadsheetdeleterow.md) - Delete a row
* [SpreadsheetSetCellValue()](/boxlang-+-++/modules/bx-spreadsheet/built-in-functions/spreadsheetsetcellvalue.md) - Set individual cell values
* [SpreadsheetFormatRow()](/boxlang-+-++/modules/bx-spreadsheet/built-in-functions/spreadsheetformatrow.md) - Format a row
* [Row Operations Guide](https://github.com/ortus-boxlang/boxlang-docs/tree/v1.x/boxlang-framework/boxlang-plus/modules/bx-spreadsheet/row-operations.md) - Working with rows


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
