Skip to main content

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

CODE
(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.

  • true: The import is done in preview mode. It will return details about which data is updated in the Flex container but without committing any changes at the end.

  • false: The import will execute and commit all changes.

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:

  • field (object): An object defining the label column.

  • value (int?): Null or the numeric label value

The example below sets label no 20 to option value 4 and clears label no 21. The language qualifier is mandatory.

CODE
"changes": [
  { "field": { "fkey": "8~fr~20" }, "value": 4  },
  { "field": { "fkey": "8~de~21" }, "value": null  }
]

See Spreadsheet Layout (Object) for how to construct the label field object.

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:

CODE
{
  "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:

CODE
{
	"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

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.