---
title: Custom
description: See available data formats
documentId: ipaas-data-formats-custom
locale: en-US
---

The **Custom** option allows you to use **Excel** as a reference, enabling the integration flow to process files in `.xls` and `.xlsx` formats via **EIP marshal**.

In this case, the format converts the rows of the specified spreadsheet into a JSON array of objects, and the generated JSON object for each cell will contain, in addition to the value, metadata about the data type.

<Callout type="note" title="NOTE">
The visual styles of the spreadsheet (cell color, font color, bold, borders, etc.) are not imported.
</Callout>

You can customize the conversion behavior using the headers (setHeader) `SensediaExcelFormat` and `SensediaExcelSheetNames`:

| Header                   | Description                                                                              | Required | Default value     |
|--------------------------|------------------------------------------------------------------------------------------|----------|------------------|
| `SensediaExcelFormat`    | Defines the file format: `.xls` or `.xlsx`. Other values will result in an error.         | No       | `.xlsx`          |
| `SensediaExcelSheetNames`| List of sheet names to be processed, separated by commas.                                | No       | -                |

<Callout type="important" title="IMPORTANT">
* Only the sheets listed in `SensediaExcelSheetNames` will be processed.
* Non-existent sheet names in the spreadsheet will be ignored.
* If the `SensediaExcelSheetNames` header is provided but no name matches an existing sheet, the component will return an error.
* Formulas are supported, but invalid formulas will result in an error in the Excel cell.
</Callout>

## JSON Format

After converting an Excel file to JSON, the data is organized as shown in the following JSON Schema:

```json
{
  "type": "object",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Excel spreadsheet data schema",
  "description": "Schema for a data structure representing one or more spreadsheets with rows and cells.",
  "properties": {
    "sheets": {
      "description": "An array containing data for each sheet",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "description": "The name of the sheet.",
            "type": "string"
          },
          "rows": {
            "description": "The rows within a single sheet",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "cells": {
                  "description": "The rows within a single row",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "v": {
                        "description": "The value of the cell. Can be a string, a number, or a boolean.",
                        "oneOf": [
                          { "type": "string" },
                          { "type": "number" },
                          { "type": "boolean" }
                        ]
                      },
                      "addr": {
                        "description": "The address of the cell (e.g., 'A1').",
                        "type": "string"
                      },
                      "type": {
                        "description": "The data type of the cell.",
                        "type": "string",
                        "enum": [
                          "str",
                          "num",
                          "bool",
                          "blank",
                          "formula"
                        ],
                        "default": "str"
                      },
                      "fmt": {
                        "description": "The formatting string for the cell's value.",
                        "type": "string",
                        "default": "General"
                      }
                    },
                    "required": [
                      "addr"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "cells"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "name",
          "rows"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "sheets"
  ],
  "additionalProperties": false
}
```

## Comparison between Excel and JSON

Now, compare an Excel spreadsheet with its JSON version:

**Excel**

![](https://creative-ball-51b3fc85c0.media.strapiapp.com/planilha_excel_borda_b682a421cb.png)

**JSON**

```json
{
  "sheets": [
    {
      "name": "Sheet1",
      "rows": [
        {
          "cells": [
            {
              "v": "Produto",
              "addr": "A1"
            },
            {
              "v": "Preço Unitário",
              "addr": "B1"
            },
            {
              "v": "Data/hora",
              "addr": "C1"
            },
            {
              "v": "Ativo",
              "addr": "D1"
            },
            {
              "v": "Quantidade",
              "addr": "E1"
            },
            {
              "v": "Desconto (%)",
              "addr": "F1"
            },
            {
              "v": "Preço Total",
              "addr": "G1"
            }
          ]
        },
        {
          "cells": [
            {
              "v": "Caneta",
              "addr": "A2"
            },
            {
              "type": "num",
              "v": 2.5,
              "addr": "B2"
            },
            {
              "type": "num",
              "v": 45915.4131373611,
              "addr": "C2",
              "fmt": "m/d/yyyy\\ h:mm:ss"
            },
            {
              "type": "bool",
              "v": true,
              "addr": "D2",
              "fmt": "\"TRUE\";\"TRUE\";\"FALSE\""
            },
            {
              "type": "num",
              "v": 10,
              "addr": "E2"
            },
            {
              "type": "num",
              "v": 0,
              "addr": "F2"
            },
            {
              "type": "num",
              "v": 25,
              "addr": "G2"
            }
          ]
        },
        {
          "cells": [
            {
              "v": "Caderno",
              "addr": "A3"
            },
            {
              "type": "num",
              "v": 15,
              "addr": "B3"
            },
            {
              "type": "num",
              "v": 45915.4131373611,
              "addr": "C3",
              "fmt": "m/d/yyyy\\ h:mm:ss"
            },
            {
              "type": "bool",
              "v": true,
              "addr": "D3",
              "fmt": "\"TRUE\";\"TRUE\";\"FALSE\""
            },
            {
              "type": "num",
              "v": 5,
              "addr": "E3"
            },
            {
              "type": "num",
              "v": 10,
              "addr": "F3"
            },
            {
              "type": "num",
              "v": 67.5,
              "addr": "G3"
            }
          ]
        },
        {
          "cells": [
            {
              "v": "Lápis",
              "addr": "A4"
            },
            {
              "type": "num",
              "v": 1.5,
              "addr": "B4"
            },
            {
              "type": "num",
              "v": 45915.4131373611,
              "addr": "C4",
              "fmt": "m/d/yyyy\\ h:mm:ss"
            },
            {
              "type": "bool",
              "v": true,
              "addr": "D4",
              "fmt": "\"TRUE\";\"TRUE\";\"FALSE\""
            },
            {
              "type": "num",
              "v": 20,
              "addr": "E4"
            },
            {
              "type": "num",
              "v": 5,
              "addr": "F4"
            },
            {
              "type": "num",
              "v": 28.5,
              "addr": "G4"
            }
          ]
        },
        {
          "cells": [
            {
              "v": "Borracha",
              "addr": "A5"
            },
            {
              "type": "num",
              "v": 3,
              "addr": "B5"
            },
            {
              "type": "num",
              "v": 45915.4131373611,
              "addr": "C5",
              "fmt": "m/d/yyyy\\ h:mm:ss"
            },
            {
              "type": "bool",
              "v": true,
              "addr": "D5",
              "fmt": "\"TRUE\";\"TRUE\";\"FALSE\""
            },
            {
              "type": "num",
              "v": 8,
              "addr": "E5"
            },
            {
              "type": "num",
              "v": 0,
              "addr": "F5"
            },
            {
              "type": "num",
              "v": 24,
              "addr": "G5"
            }
          ]
        },
        {
          "cells": [
            {
              "v": "Régua",
              "addr": "A6"
            },
            {
              "type": "num",
              "v": 4.5,
              "addr": "B6"
            },
            {
              "type": "num",
              "v": 45915.4131373611,
              "addr": "C6",
              "fmt": "m/d/yyyy\\ h:mm:ss"
            },
            {
              "type": "bool",
              "v": false,
              "addr": "D6",
              "fmt": "\"TRUE\";\"TRUE\";\"FALSE\""
            },
            {
              "type": "num",
              "v": 3,
              "addr": "E6"
            },
            {
              "type": "num",
              "v": 15,
              "addr": "F6"
            },
            {
              "type": "num",
              "v": 11.475,
              "addr": "G6"
            }
          ]
        },
        {
          "cells": [
            {
              "v": "Total Geral",
              "addr": "A7"
            },
            {
              "type": "num",
              "v": 156.475,
              "addr": "G7"
            }
          ]
        },
        {
          "cells": [
            {
              "v": "Média Preço Unitário",
              "addr": "A8"
            },
            {
              "type": "num",
              "v": 5.3,
              "addr": "G8"
            }
          ]
        }
      ]
    }
  ]
}
```

## Code Example

This flow exposes a REST endpoint (`GET /teste-excel`) that, when called, downloads an Excel file from an SFTP server, converts the content to JSON, and returns the result.

The processing occurs as follows:

<Steps>
<Step>
Receives the GET request.
</Step>
<Step>
Logs the start of the file download via SFTP.
</Step>
<Step>
Downloads the file from the SFTP server.
</Step>
<Step>
Logs the completion of the download and the conversion to JSON.
</Step>
<Step>
Converts the content to `byte[]`.
</Step>
<Step>
Sets in *setHeader* the sheet names to be processed (`test1,test2`).
</Step>
<Step>
Uses `marshal` with the *data format* `excel` (*custom*) to transform the file into JSON.
</Step>
<Step>
Sets the *setHeader* `Content-Type` as `application/json` for the response.
</Step>
</Steps>

```yaml
- from:
    uri: rest:get:/teste-excel
    steps:
      - log:
          message: "Starting file download via SFTP."
      - pollEnrich:
          expression:
            simple: "sftp:eu-central-1.sftpcloud.io:22/download?username={{user}}&password={{pass}}&passiveMode=true&delete=false&fileName={{file}}&binary=true&knownHostsFile=/dev/null&strictHostKeyChecking=no"
      - log:
          message: "Download completed. Converting to JSON."
      - convertBodyTo:
          type: byte[]
      - setHeader:
          name: SensediaExcelSheetNames
          expression:
            constant:
              expression: test1,test2
      - marshal:
          custom:
            ref: excel
      - setHeader:
          name: Content-Type
          constant: application/json
```

<Callout type="important" title="IMPORTANT">
Excel can also be used in flows with **EIP unmarshal** (to transform JSON files into Excel).

* In this case, the **addr** field of the input JSON will not be considered.
* The assembly of rows and columns will be based only on the order of rows and cells.
* The result of the unmarshal will be a byte[].
</Callout>
