XLSX to XML
You need to convert one or more XLSX file to an XML format.
Inputs
Input example
json
{
"name": "file-conversion-xlsx-to-xml",
"taskReferenceName": "xlsx_to_xml",
"description": "The business description of the task",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"mode": "FILE",
"file": "${previous_taskReferenceName.output.file}",
"sheets": [
{
"name": "Test",
"areas": [
{
"startColumn": 1,
"endColumn": 2,
"startLine": 1,
"endLine": 5
}
]
}
]
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
json
{
"name": "file-conversion-xlsx-to-xml",
"taskReferenceName": "xlsx_to_xml",
"description": "The business description of the task",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"mode": "FILES",
"files": "${previous_taskReferenceName.output.files}",
"sheets": [
{
"name": "Test",
"areas": [
{
"startColumn": 1,
"endColumn": 2,
"startLine": 1,
"endLine": 5
}
]
}
]
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Definition
| Property | Type | Required | Description |
|---|---|---|---|
| The name (or type) of the task | |||
| The unique name of the task in your job. It is used to reference this task in the workflow. | |||
| The functional description of this task in your job. | |||
The type of the task. It must be SUB_WORKFLOW. | |||
| : | true: the job continues if there is an error on this task. false: the job fails. | ||
| Input parameters of the task. See below |
Inputs
| Property | Type | Required | Description |
|---|---|---|---|
A valid xlsx input file. It can reference the output of a previous task, example: ${previous_taskReferenceName.output.file}, or a static file, example: file://assets/file.xlsx, or a user input, example: ${workflow.input.input_key}. | |||
A valid list of xlsx input files. It can reference the output of a previous task, example: ${previous_taskReferenceName.output.files}, or a user input, example: ${workflow.input.input_key}. | |||
An array of xlsx sheets | |||
| The name of the sheet | |||
| An array of objects describing the area to be parsed. | |||
| The starting column number of the area to be parsed. | |||
| The ending column number of the area to be parsed. | |||
| The starting line number of the area to be parsed. | |||
| The ending line number of the area to be parsed. | |||
| : | Default: falseWhen set to true, the report generation is skipped and thus the report is not available in the output parameters. | ||
| : | Default: info It defines the log level to be recorded in the report. error < warning < info < debug |
Outputs
| Property | Type | Description |
|---|---|---|
| An XML file as described below. | ||
YES | NO. YES: all files have been transformed successfully. NO: at least one file has not been transformed. |
A <File> element is written only for the files that were converted. When a file fails, allFilesTransformed becomes NO and that file simply has no <File> - the task itself still completes. If every file fails, the document holds no <File> at all.
Output file example
xml
<Xlsx-To-Xml>
<File>
<File-Name>products.xlsx</File-Name>
<Sheets>
<Sheet>
<Sheet-Name>products</Sheet-Name>
<Sheet-Index>1</Sheet-Index>
<Rows>
<R i="1">
<C j="1">EAN</C>
</R>
<R i="2">
<C j="1">1234567890123</C>
</R>
</Rows>
</Sheet>
</Sheets>
</File>
</Xlsx-To-Xml>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Output file definition
| XPath | Description | Occurs |
|---|---|---|
| Xlsx-To-Xml | Root of the document. | 1 |
| ./File | For each successfully transformed file - see the note below. | 0..* |
| ./File-Name | Original file name. | 1 |
| ./Sheets | Sheets. | 1 |
| ./Sheets/Sheet | Sheet, one by sheet. | 0..* |
| ../Sheet/Sheet-Name | Sheet name. | 1 |
| ../Sheet/Sheet-Index | Sheet position in the workbook, starting at 1. | 1 |
| ../Sheet/Rows | Rows. | 1 |
| ../Sheet/Rows/R | R = Row, one by row. | 0..* |
| ../Sheet/Rows/R/@i | i = the row number in the sheet, starting at 1. | 1 |
| ../Sheet/Rows/R/C | C = Column. One by cell, nested inside its R. | 0..* |
| ../Sheet/Rows/R/C/@j | j = the column number in the sheet, starting at 1. | 1 |
@i and @j are the coordinates of the cell in the sheet, not offsets inside the area you asked for. Extracting the area B5:D10 therefore yields rows numbered from 5 and columns from 2, which lines up with what the spreadsheet itself displays.
A row with no content at all is skipped, and so is a cell holding a formula the converter cannot evaluate - in that case a warning naming the cell is written to the logs. So a given R may be missing some of its C.
Limits and additional notes
- The limitation of the input file size is 250 Mb.
FAQ
How to convert XLS files?
For now can’t. Only .xslx files can be converted. Therefore you need to save your file with the .xslx extension.
How to convert CSV files?
You can use the task CSV to XML.
Does the empty lines are exported?
No.
Why is there no <File> in the generated output file ?
It can be due to the fact that you mentioned a sheet that does not exist in the xlsx file.