# ConvertToJSON

Required Frends version: 5.5+

Required .NET version: 6.0

Compatible Agents: Crossplatform

Source code: <https://github.com/FrendsPlatform/Frends.Excel/tree/main/Frends.Excel.ConvertToJSON>

{% tabs %}
{% tab title="Parameter: Input" %}

| Name            | Description                                                                                                                         |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| Path : `String` | <p>Path to the Excel file.</p><p><br>Default: <code>C:\tmp\ExcelFile.xlsx</code><br>Example: <code>C:\tmp\ExcelFile.xlsx</code></p> |
| {% endtab %}    |                                                                                                                                     |

{% tab title="Parameter: Options" %}

| Name                                  | Description                                                                                                                                                                                                                                                                                                                                                                                                 |
| ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ReadOnlyWorkSheetWithName : `String`  | <p>If empty, all work sheets are read.</p><p><br>Default: <code>-</code><br>Example: <code>Sheet1</code></p>                                                                                                                                                                                                                                                                                                |
| UseNumbersAsColumnHeaders : `Boolean` | <p>If set to true, numbers will be used as column headers instead of letters (A = 1, B = 2...).</p><p><br>Default: <code>false</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                     |
| ThrowErrorOnFailure : `Boolean`       | <p>Choose if exception should be thrown when conversion fails.</p><p><br>Default: <code>true</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                       |
| DateFormat : `DateFormats`            | <p>Date format selection.</p><p>Possible values:</p><ul><li><code>DEFAULT</code>:</li></ul><p>Date format selection.</p><ul><li><code>DDMMYYYY</code>:</li></ul><p>Date format selection.</p><ul><li><code>MMDDYYYY</code>:</li></ul><p>Date format selection.</p><ul><li><code>YYYYMMDD</code>:</li></ul><p>Date format selection.</p><p><br>Default: <code>0</code><br>Example: <code>DDMMYYYY</code></p> |
| ShortDatePattern : `Boolean`          | <p>If set to true, dates will exclude timestamps from dates.</p><p>Default false</p><p><br>Default: <code>false</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                    |
| {% endtab %}                          |                                                                                                                                                                                                                                                                                                                                                                                                             |

{% tab title="Result: Result" %}

| Name                    | Description                                                                                                                                                                                                                                                                                                                                                                                                           |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Success : `Boolean`     | <p>Indicates if the conversion was successful.<br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                      |
| ErrorMessage : `String` | <p>Exception message.<br>Example: <code>An error occurred...</code></p>                                                                                                                                                                                                                                                                                                                                               |
| JSON : `String`         | <p>Excel-conversion to JSON.<br>Example: <code>"{"workbook":{"workbook\_name":"ExcelTestInput2.xls","worksheet":{"name":"Sheet1","rows":\[{"RowNumber":1,"Cells":\[{"ColumnName":"A","ColumnIndex":1,"ColumnValue":"Foo"},{"ColumnName":"B","ColumnIndex":2,"ColumnValue":"Bar"},{"ColumnName":"C","ColumnIndex":3,"ColumnValue":"Kanji働"},{"ColumnName":"D","ColumnIndex":4,"ColumnValue":"Summa"}]}]}}}"</code></p> |
| {% endtab %}            |                                                                                                                                                                                                                                                                                                                                                                                                                       |

{% tab title="Changelog" %}

## Changelog

### \[2.2.0] - 2026-01-22

#### Changed

* Open Excel files with FileAccess.Read to support read-only files

### \[2.1.0] - 2024-08-21

#### Changed

* Updated the Newtonsoft.Json package to the latest version.

### \[2.0.0] - 2023-03-21

#### Changed

* Change how the Json is constructed.
* Added CancellationToken to the Task.
* Refactored code to be more simple.
* Added two helper classes Row and Cell.

### \[1.0.1] - 2022-08-02

#### Changed

* Updated the documentation with better descriptions and examples.

#### Fixed

* Nuget package should not contain the FrendsTasksMetadata.json files.

### \[1.0.0] - 2022-03-03

#### Added

* Initial implementation
  {% endtab %}
  {% endtabs %}
