Import Excel / Flex
Use this method to import strings from an Excel into a Flex container. The mechanism is basically the same compared to a regular push but uses an Excel rather than a JSON.
URL
(POST) /api/apps/wbflex/documents/{id}/io/import
PARAMETERS
The URL parameters are:
id | Specify either a document ID (such as 1000) or a job ID (such as c300). | string, Mandatory |
The BODY must be a JSON object with these properties:
fileToken | References the Excel file. Use media/upload to upload your file and to obtain a token. | string, Mandatory |
preview | Boolean, optional. If not set then value is true.
| bool?, Optional |
layout | Optional. A layout object. The layout defines the columns of the Excel file. If not specified, a default layout will be used. See Excel Layout - Defining Columns for details. | object, Optional |
changes | Optional array with labels that shall be set / reset on all the imported segments. Each array element has these properties:
The example below sets label no 20 to option value 4 and clears label no 21. The language qualifier is mandatory.
CODE
See Spreadsheet Layout (Object) for how to construct the label | object[], Optional |
callback | Specify a URL which will be called upon success or failure of operation. This makes polling for operation status unnecessary. See Callbacks (with asynchronous operations) | object, Optional |
RESULTS
The operation is asynchronous and may take a few seconds to complete. The method returns an Asynchronous operation result:
{
"trm": {
"requestid":32230,
"status":"Waiting",
"statusText":"Waiting..."
}
}
Specify the callback in the payload to be automatically notified of completion. Otherwise you need to poll the operation for completion (until status = “Finished”). When finished (or via the callback) you obtain the results as a JSON:
{
"trm": {
"requestid": 0,
"isbatch": false,
"status": "Finished",
"statusText": "Finished!"
},
"result": {
"items": []
},
"custom": {
"type": "Push",
"transaction": "ad21907d-e039-4ff9-ba43-e104aa0c91ea",
"isPreview": true,
"ts": "2025-03-10T10:10:53.6951237Z",
"origin": null,
"cid": 537,
"pid": 562,
"success": true,
"messages": [
"File upload: data.xlsx [4]"
],
"errors": null,
"updates": {
"targetParagraphs": 4,
"targetSegments": 4,
"total": 4,
"totalAdded": 0,
"totalUpdated": 4,
"totalInvalid": 0,
"totalRemoved": 0,
"texts": {
"de": 4,
"en": 1
},
"textsMeta": {},
"newProblemsAdditions": {},
"newProblemsUpdates": {
"ar": 1,
"de": 1
},
"wc": { ... }
},
"po": { "messages": [] },
"source": { ... },
"operation": { ... },
"content": {
"rows": 4,
"valid": 4,
"invalid": 0,
"skipped": 0,
"errors": []
}
}
}
The custom
node contains the results:
content | Provides a summary of data including any errors. A file that has errors cannot be imported. See Excel Validation Results for details. | object |
*** | All other properties are the same as with the documents/{id}/contents/push method. You need to carefully process some key properties to understand if the import was successful or not. | object |