---
schema_version: "1"
id: 162dd92f0b43021f590895be3eba479d4eb1ec3548a2b096c56da5a3a1e81428
title: Excel Format
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.11/dataweave-formats-excel.md
canonical_url: https://docs.mulesoft.com/dataweave/2.11/dataweave-formats-excel
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 5646607cf328b333e8dbe8295fc80683ccfd85162f32d41f010e472f676b9e5b
description: MuleSoft Documentation Site
release: "2.11"
latest: false
---
---
product: DataWeave
version: 2.11
keywords: format, excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/xlsx, application/xlsx
---

# Excel Format

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

MIME type: `application/xlsx`

ID: `excel`

An Excel workbook is a sequence of sheets. In DataWeave, this is mapped to an object where each
sheet is a key. Only one table is allowed per Excel sheet. A table is expressed as an array of rows.
A row is an object where its keys are the columns and the values the cell content.

> [!NOTE] Only `.xlsx` files are supported (Excel 2007). `.xls` files are not supported by Mule.

The DataWeave reader for Excel input supports the following parsing strategies:

- In-Memory

- Streaming

To understand the parsing strategies that DataWeave readers and writers can apply to this format,
see [DataWeave Parsing Strategies](https://docs.mulesoft.com/dataweave/2.11/dataweave-formats#dw_readers_writers).

## Excel Type Mapping

The following table shows how Excel types map to DataWeave types.

<table><colgroup><col> <col></colgroup><thead><tr><th>Excel Type</th><th>DataWeave Type</th></tr></thead><tbody><tr><td><p><code>String</code></p></td><td><p><code>String</code></p></td></tr><tr><td><p><code>Numeric</code></p></td><td><p><code>Number</code></p></td></tr><tr><td><p><code>Boolean</code></p></td><td><p><code>Boolean</code></p></td></tr><tr><td><p><code>Data</code></p></td><td><p><code>Date</code></p></td></tr></tbody></table>

## Examples

The following examples show uses of the Excel format.

- [Example: Represent Excel in the DataWeave (dw) Format](#example1)

- [Example: Output an Excel Table](#example2)

- [Example: Stream Excel Input](#example3)

### Example: Represent Excel in the DataWeave (dw) Format

This example shows how DataWeave represents an Excel workbook.

#### Input

The Excel workbook (`Sheet1`) serves as an input payload for the DataWeave source.

Sheet1:

. | A | B 1 | Id | Name 2 | 123 | George 3 | 456 | Lucas

#### Source

The DataWeave script transforms the Excel input payload to the DataWeave (dw) format and MIME type.

```dataweave
%dw 2.0
output application/dw
---
payload
```

#### Output

The DataWeave output looks like this. You can select values the same way you select values in other
objects.

```dataweave
{
    "Sheet1": [
        {
                "A": 123,
                "B": "George"
        },
        {
                "A": 456,
                "B": "Lucas"
        }
    ]
}
```

### Example: Output an Excel Table

The following DataWeave script outputs an Excel table with the header and fields.

The body of this DataWeave script is a DataWeave object that defines the content of the Excel sheet.
The name of the sheet, `Sheet1`, is the key of this object. The value is an array of objects. Each
object in the array contains a collection of key-value pairs. The keys in each pair are treated as
header values for the spreadsheet. The values in each pair are treated as data values for a row in
the sheet.

The output directive indicates that the output is the Excel format and MIME type. The `header=true`
setting indicates that the output includes the header values.

```dataweave
%dw 2.0
output application/xlsx header=true
---
{
  Sheet1: [
    {
      Id: 123,
      Name: George
    },
    {
      Id: 456,
      Name: Lucas
    }
  ]
}
```

For another example, see [Look Up Data in an Excel (XLSX) File](https://docs.mulesoft.com/dataweave/2.11/dataweave-cookbook-xlsx-lookup).

### Example: Stream Excel Input

By default, the Excel reader stores input data from an entire file in-memory if the file is 1.5MB or
less. If the file is larger than 1.5 MB, the process writes the data to disk. For very large files,
you can improve the performance of the reader by setting a `streaming` property to `true`.

The following Configuration XML for a Mule application streams an Excel file and transforms it to
JSON.

```xml
<http:listener-config
    name="HTTP_Listener_config"
    doc:name="HTTP Listener config" >
  <http:listener-connection host="0.0.0.0" port="8081" />
</http:listener-config>
<flow name="streaming_flow" >
  <http:listener
    doc:name="Listener"
    config-ref="HTTP_Listener_config"
    path="/"
    outputMimeType="application/xlsx; streaming=true"/>
  <ee:transform doc:name="Transform Message" >
    <ee:message >
      <ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
payload."Sheet Name" map ((row) -> {
    foo: row.a,
    bar: row.b
})]]></ee:set-payload>
    </ee:message>
  </ee:transform>
</flow>
```

The example:

- Configures the HTTP listener to stream the XLSX input by setting
  `outputMimeType="application/xlsx; streaming=true"`. In the Studio UI, you can use the **MIME
  Type** on the listener to `application/xlsx` and the **Parameters** for the MIME Type to **Key**
  `streaming` and **Value** `true`.

- Uses a DataWeave script in the **Transform Message** component to iterate over each row in the
  XLSX payload (an XLSX sheet called `"Sheet Name"`) and select the values of each cell in the row
  (using `row.a`, `row.b`). It assumes columns named `a` and `b` and maps the values from each row
  in those columns into `foo` and `bar`, respectively.

#### Output

The following image shows the Excel table output.

![A table in an Excel format displaying IDs and names](/mulesoft/current/en-us/dataweave/2.11/_images/dataweave-formats-exceltable.png)

## Limitations

- Macros are currently not supported.

- Charts are ignored.

- Pivot tables are not supported.

- Formatting is currently not supported.

## Configuration Properties

DataWeave supports the following configuration properties for this format.

### Reader Properties

This format accepts properties that provide instructions for reading input data.

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Parameter</th><th>Type</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><p><code>header</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>true</code></p></td><td><div><div><p>Indicates whether the first line of the output contains header field names.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>ignoreEmptyLine</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>true</code></p></td><td><div><div><p>Ignores an empty line by default.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>maxEntrySize</code></p></td><td><p><code>Number</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Sets the maximum number of bytes a single entry in a ZIP file can have.</p></div></div></td></tr><tr><td><p><code>minInflateRatio</code></p></td><td><p><code>Number</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Sets the ratio between de- and inflated bytes to detect zip bomb. For example, if you set the value to 1 percent (= 0.01d) when the compression is better than 1 percent for any given read package part, the parsing fails to indicate a zip bomb.</p></div></div></td></tr><tr><td><p><code>streaming</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>Streams input when set to <code>true</code>. Use only if entries are accessed sequentially. The input must be a top-level array. See the <a href="#example2">streaming example</a>, and see <a href="https://docs.mulesoft.com/dataweave/latest/dataweave-formats#dw_readers_writers">DataWeave Readers</a>.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>tableLimit</code></p></td><td><p><code>String</code></p></td><td><p><code>'Unbounded'</code></p></td><td><div><div><p>Position of the last column in each row. Accepts a pattern <code>&lt;Column&gt;</code> (for example, <code>'A'</code> or <code>'AB'</code>), the value <code>'HeaderSize'</code>, which uses the location of the last header, or 'Unbounded', which consumes each row.</p></div></div></td></tr><tr><td><p><code>tableOffset</code></p></td><td><p><code>String</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Sets the position of the first cell. Accepts the pattern <code>&lt;Column&gt;&lt;Row&gt;</code>, for example, <code>A1</code> or <code>B3</code>.</p></div></div></td></tr><tr><td><p><code>zipBombCheck</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>true</code></p></td><td><div><div><p>Turns off the zip bomb (decompression bomb) check when set to <code>false</code>.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr></tbody></table>

### Writer Properties

This format accepts properties that provide instructions for writing output data.

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Parameter</th><th>Type</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><p><code>bufferSize</code></p></td><td><p><code>Number</code></p></td><td><p><code>8192</code></p></td><td><div><div><p>Size of the buffer writer, in bytes. The value must be greater than <code>8</code>.</p></div></div></td></tr><tr><td><p><code>deferred</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>Generates the output as a data stream when set to <code>true</code>, and defers the script’s execution until the generated content is consumed.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>header</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>true</code></p></td><td><div><div><p>Indicates whether the first line of the output contains header field names.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>ignoreEmptyLine</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>true</code></p></td><td><div><div><p>Ignores an empty line by default.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>maxEntrySize</code></p></td><td><p><code>Number</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Sets the maximum number of bytes a single entry in a ZIP file can have.</p></div></div></td></tr><tr><td><p><code>minInflateRatio</code></p></td><td><p><code>Number</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Sets the ratio between de- and inflated bytes to detect zip bomb. For example, if you set the value to 1 percent (= 0.01d) when the compression is better than 1 percent for any given read package part, the parsing fails to indicate a zip bomb.</p></div></div></td></tr><tr><td><p><code>tableOffset</code></p></td><td><p><code>String</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Sets the position of the first cell. Accepts the pattern <code>&lt;Column&gt;&lt;Row&gt;</code>, for example, <code>A1</code> or <code>B3</code>.</p></div></div></td></tr><tr><td><p><code>zipBombCheck</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>true</code></p></td><td><div><div><p>Turns off the zip bomb (decompression bomb) check when set to <code>false</code>.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr></tbody></table>

## Supported MIME Types

This format supports the following MIME types.

<table><colgroup><col></colgroup><thead><tr><th>MIME Type</th></tr></thead><tbody><tr><td><p><code>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</code></p></td></tr><tr><td><p><code>application/xlsx</code></p></td></tr></tbody></table>
