# excelxport

(plugins.excelxport)

## Overview

The `Xport menu enabler` plugin provides tools for exporting and importing data to and from Excel files, offering flexibility in managing worksheets, templates, and data structures. It supports enabling or disabling export and import functionalities through its `exportEnabled` and `importEnabled` properties, allowing seamless integration into applications. ## Primary Method

The plugin’s primary method, `excelExport`, facilitates exporting data from specified data sources to Excel files. Users can customize the process by:

* Choosing data attributes
* Applying templates
* Setting sheet names
* Defining column headers
* Specifying starting rows and columns This ensures structured and well-formatted Excel outputs tailored to specific requirements.

## Features

With features like template support, custom headers, and flexible positioning, `excelxport` simplifies the interaction with Excel files. It enhances workflows by enabling dynamic data handling and output formatting, making it an essential tool for data-driven applications requiring Excel integration.

## Properties Summarized

| Type                                                                           | Name                            | Summary                                   |
| ------------------------------------------------------------------------------ | ------------------------------- | ----------------------------------------- |
| [Boolean](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/boolean) | [exportEnabled](#exportenabled) | Enable the export feature of this plugin. |
| [Boolean](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/boolean) | [importEnabled](#importenabled) | Enable the import feature of this plugin. |

## Methods Summarized

| Type                                                                       | Name                                                                                                                                                                                                           | Summary              |
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
| [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) | [excelExport(foundSet, dataProviderIds)](#excelexport-foundset-dataproviderids)                                                                                                                                | Export to Excel data |
| [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) | [excelExport(foundSet, dataProviderIds, templateXLS)](#excelexport-foundset-dataproviderids-templatexls)                                                                                                       | Export to Excel data |
| [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) | [excelExport(foundSet, dataProviderIds, templateXLS, sheetName)](#excelexport-foundset-dataproviderids-templatexls-sheetname)                                                                                  | Export to Excel data |
| [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) | [excelExport(foundSet, dataProviderIds, templateXLS, sheetName, outputColumnNames, startRow)](#excelexport-foundset-dataproviderids-templatexls-sheetname-outputcolumnnames-startrow)                          | Export to Excel data |
| [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) | [excelExport(foundSet, dataProviderIds, templateXLS, sheetName, startRow, startColumn)](#excelexport-foundset-dataproviderids-templatexls-sheetname-startrow-startcolumn)                                      | Export to Excel data |
| [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) | [excelExport(foundSet, dataProviderIds, templateXLS, sheetName)](#excelexport-foundset-dataproviderids-templatexls-sheetname)                                                                                  | Export to Excel data |
| [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) | [excelExport(foundSet, dataProviderIds, templateXLS, sheetName, outputColumnNames, startRow)](#excelexport-foundset-dataproviderids-templatexls-sheetname-outputcolumnnames-startrow)                          | Export to Excel data |
| [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) | [excelExport(foundSet, dataProviderIds, templateXLS, sheetName, outputColumnNames, startRow, startColumn)](#excelexport-foundset-dataproviderids-templatexls-sheetname-outputcolumnnames-startrow-startcolumn) | Export to Excel data |

## Properties Detailed

### exportEnabled

Enable the export feature of this plugin.

**Type**\
[Boolean](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/boolean) true if the export feature is enabled; otherwise, false.

**Sample**

```js
plugins.excelxport.exportEnabled = true;
var isEnabled = plugins.excelxport.exportEnabled;
```

### importEnabled

Enable the import feature of this plugin.

**Type**\
[Boolean](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/boolean) true if the import feature is enabled; otherwise, false.

**Sample**

```js
plugins.excelxport.importEnabled = true;
var isEnabled = plugins.excelxport.importEnabled;
```

## Methods Detailed

### excelExport(foundSet, dataProviderIds)

Export to Excel data

**Parameters**

* [JSFoundSet](https://docs.servoy.com/reference/servoycore/dev-api/database-manager/jsfoundset) **foundSet** the foundset on which to export
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **dataProviderIds** the ids of the dataproviders

**Returns:** [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) A byte array representing the exported Excel data.

**Sample**

```js
//export in new byte array
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name']);
//export by adding to templateXLS in default (new) 'Servoy Data' worksheet
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS);
//export by adding to templateXLS, in 'mySheet' worksheet, starting at default(1/1) row/column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet');
//export by adding to templateXLS, in 'mySheet' worksheet, with column names 'ID' and 'Name' starting at default(1/1) row/column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet', ['ID', 'Name']);
//export by adding to templateXLS, in 'mySheet' worksheet, starting at 3rd row and 5th column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet',3,5);
* //export by adding to templateXLS, in 'mySheet' worksheet, with column names 'ID' and 'Name', starting at 3rd row and 5th column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet', ['ID', 'Name'], 3, 5);
```

### excelExport(foundSet, dataProviderIds, templateXLS)

Export to Excel data

**Parameters**

* [JSFoundSet](https://docs.servoy.com/reference/servoycore/dev-api/database-manager/jsfoundset) **foundSet** the foundset on which to export
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **dataProviderIds** the ids of the dataproviders
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **templateXLS** the xls template to export in

**Returns:** [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) A byte array representing the exported Excel data.

**Sample**

```js
//export in new byte array
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name']);
//export by adding to templateXLS in default (new) 'Servoy Data' worksheet
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS);
//export by adding to templateXLS, in 'mySheet' worksheet, starting at default(1/1) row/column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet');
//export by adding to templateXLS, in 'mySheet' worksheet, with column names 'ID' and 'Name' starting at default(1/1) row/column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet', ['ID', 'Name']);
//export by adding to templateXLS, in 'mySheet' worksheet, starting at 3rd row and 5th column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet',3,5);
* //export by adding to templateXLS, in 'mySheet' worksheet, with column names 'ID' and 'Name', starting at 3rd row and 5th column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet', ['ID', 'Name'], 3, 5);
```

### excelExport(foundSet, dataProviderIds, templateXLS, sheetName)

Export to Excel data

**Parameters**

* [JSFoundSet](https://docs.servoy.com/reference/servoycore/dev-api/database-manager/jsfoundset) **foundSet** the foundset on which to export
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **dataProviderIds** the ids of the dataproviders
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **templateXLS** the xls template to export in
* [String](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/string) **sheetName** the name of the worksheet

**Returns:** [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) A byte array representing the exported Excel data.

**Sample**

```js
//export in new byte array
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name']);
//export by adding to templateXLS in default (new) 'Servoy Data' worksheet
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS);
//export by adding to templateXLS, in 'mySheet' worksheet, starting at default(1/1) row/column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet');
//export by adding to templateXLS, in 'mySheet' worksheet, with column names 'ID' and 'Name' starting at default(1/1) row/column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet', ['ID', 'Name']);
//export by adding to templateXLS, in 'mySheet' worksheet, starting at 3rd row and 5th column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet',3,5);
* //export by adding to templateXLS, in 'mySheet' worksheet, with column names 'ID' and 'Name', starting at 3rd row and 5th column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet', ['ID', 'Name'], 3, 5);
```

### excelExport(foundSet, dataProviderIds, templateXLS, sheetName, outputColumnNames, startRow)

Export to Excel data

**Parameters**

* [JSFoundSet](https://docs.servoy.com/reference/servoycore/dev-api/database-manager/jsfoundset) **foundSet** the foundset on which to export
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **dataProviderIds** the ids of the dataproviders
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **templateXLS** the xls template to export in
* [String](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/string) **sheetName** the name of the worksheet
* [Object](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/object) **outputColumnNames** is used to set the column headers independently from the dataprovider names
* [Number](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/number) **startRow** row in the foundset at which to start the export

**Returns:** [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) A byte array representing the exported Excel data.

**Sample**

```js
//export in new byte array
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name']);
//export by adding to templateXLS in default (new) 'Servoy Data' worksheet
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS);
//export by adding to templateXLS, in 'mySheet' worksheet, starting at default(1/1) row/column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet');
//export by adding to templateXLS, in 'mySheet' worksheet, with column names 'ID' and 'Name' starting at default(1/1) row/column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet', ['ID', 'Name']);
//export by adding to templateXLS, in 'mySheet' worksheet, starting at 3rd row and 5th column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet',3,5);
* //export by adding to templateXLS, in 'mySheet' worksheet, with column names 'ID' and 'Name', starting at 3rd row and 5th column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet', ['ID', 'Name'], 3, 5);
```

### excelExport(foundSet, dataProviderIds, templateXLS, sheetName, startRow, startColumn)

Export to Excel data

**Parameters**

* [JSFoundSet](https://docs.servoy.com/reference/servoycore/dev-api/database-manager/jsfoundset) **foundSet** the foundset on which to export
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **dataProviderIds** the ids of the dataproviders
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **templateXLS** the xls template to export in
* [String](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/string) **sheetName** the name of the worksheet
* [Number](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/number) **startRow** row in the foundset at which to start the export
* [Number](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/number) **startColumn** column in the foundset at which to start the export

**Returns:** [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) A byte array representing the exported Excel data.

**Sample**

```js
//export in new byte array
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name']);
//export by adding to templateXLS in default (new) 'Servoy Data' worksheet
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS);
//export by adding to templateXLS, in 'mySheet' worksheet, starting at default(1/1) row/column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet');
//export by adding to templateXLS, in 'mySheet' worksheet, with column names 'ID' and 'Name' starting at default(1/1) row/column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet', ['ID', 'Name']);
//export by adding to templateXLS, in 'mySheet' worksheet, starting at 3rd row and 5th column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet',3,5);
* //export by adding to templateXLS, in 'mySheet' worksheet, with column names 'ID' and 'Name', starting at 3rd row and 5th column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet', ['ID', 'Name'], 3, 5);
```

### excelExport(foundSet, dataProviderIds, templateXLS, sheetName)

Export to Excel data

**Parameters**

* [JSFoundSet](https://docs.servoy.com/reference/servoycore/dev-api/database-manager/jsfoundset) **foundSet** the foundset on which to export
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **dataProviderIds** the ids of the dataproviders
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **templateXLS** the xls template to export in
* [String](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/string) **sheetName** the name of the worksheet

**Returns:** [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) A byte array representing the exported Excel data.

**Sample**

```js
//export in new byte array
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name']);
//export by adding to templateXLS in default (new) 'Servoy Data' worksheet
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS);
//export by adding to templateXLS, in 'mySheet' worksheet, starting at default(1/1) row/column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet');
//export by adding to templateXLS, in 'mySheet' worksheet, with column names 'ID' and 'Name' starting at default(1/1) row/column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet', ['ID', 'Name']);
//export by adding to templateXLS, in 'mySheet' worksheet, starting at 3rd row and 5th column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet',3,5);
* //export by adding to templateXLS, in 'mySheet' worksheet, with column names 'ID' and 'Name', starting at 3rd row and 5th column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet', ['ID', 'Name'], 3, 5);
```

### excelExport(foundSet, dataProviderIds, templateXLS, sheetName, outputColumnNames, startRow)

Export to Excel data

**Parameters**

* [JSFoundSet](https://docs.servoy.com/reference/servoycore/dev-api/database-manager/jsfoundset) **foundSet** the foundset on which to export
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **dataProviderIds** the ids of the dataproviders
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **templateXLS** the xls template to export in
* [String](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/string) **sheetName** the name of the worksheet
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **outputColumnNames** is used to set the column headers independently from the dataprovider names
* [Number](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/number) **startRow** row in the foundset at which to start the export

**Returns:** [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) A byte array representing the exported Excel data.

**Sample**

```js
//export in new byte array
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name']);
//export by adding to templateXLS in default (new) 'Servoy Data' worksheet
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS);
//export by adding to templateXLS, in 'mySheet' worksheet, starting at default(1/1) row/column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet');
//export by adding to templateXLS, in 'mySheet' worksheet, with column names 'ID' and 'Name' starting at default(1/1) row/column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet', ['ID', 'Name']);
//export by adding to templateXLS, in 'mySheet' worksheet, starting at 3rd row and 5th column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet',3,5);
* //export by adding to templateXLS, in 'mySheet' worksheet, with column names 'ID' and 'Name', starting at 3rd row and 5th column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet', ['ID', 'Name'], 3, 5);
```

### excelExport(foundSet, dataProviderIds, templateXLS, sheetName, outputColumnNames, startRow, startColumn)

Export to Excel data

**Parameters**

* [JSFoundSet](https://docs.servoy.com/reference/servoycore/dev-api/database-manager/jsfoundset) **foundSet** the foundset on which to export
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **dataProviderIds** the ids of the dataproviders
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **templateXLS** the xls template to export in
* [String](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/string) **sheetName** the name of the worksheet
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **outputColumnNames** is used to set the column headers independently from the dataprovider names
* [Number](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/number) **startRow** row in the foundset at which to start the export
* [Number](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/number) **startColumn** column in the foundset at which to start the export

**Returns:** [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) A byte array representing the exported Excel data.

**Sample**

```js
//export in new byte array
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name']);
//export by adding to templateXLS in default (new) 'Servoy Data' worksheet
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS);
//export by adding to templateXLS, in 'mySheet' worksheet, starting at default(1/1) row/column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet');
//export by adding to templateXLS, in 'mySheet' worksheet, with column names 'ID' and 'Name' starting at default(1/1) row/column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet', ['ID', 'Name']);
//export by adding to templateXLS, in 'mySheet' worksheet, starting at 3rd row and 5th column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet',3,5);
* //export by adding to templateXLS, in 'mySheet' worksheet, with column names 'ID' and 'Name', starting at 3rd row and 5th column
var bytes = plugins.excelxport.excelExport(forms.form1.foundset, ['id','name'],templateXLS, 'mySheet', ['ID', 'Name'], 3, 5);
```

***
