Skip to main content

Validate Excel / Flex

Prior to importing an Excel, you might want to validate its content and adjust the contained columns and information. This method scans a new or previously exported Excel. It returns information on the columns (if this was a previous export), the number of rows and any issues with the content.

It serves two purposes:

  • Do a quick validation of an Excel prior to import.

  • Customize the layout (columns) in a user interface. Then call this method to validate that the columns are properly set (no errors in the content will be shown).

URL

CODE
(POST) /api/apps/wbflex/documents/{id}/io/import/prepare

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

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

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": { ... }
    "custom": {
        "content": {
            "rows": 4,
            "valid": 4,
            "invalid": 1,
            "skipped": 0,
            "errors": [
                {
                    "r": 3,
                    "c": 5,
                    "f": "Status - German",
                    "e": "Allowed values are NONE, GREEN, RED or blank"
                }
            ]
        },
        "layout": {
            "name": null,
            "columns": [
                {
                    "ftype": 15,
                    "loc": null,
                    "canEdit": false,
                    "fqualifier": 0,
                    "usedWith": null,
                    "fkey": "15~~0"
                },
                {
                    "ftype": 2,
                    "loc": null,
                    "canEdit": false,
                    "fqualifier": 0,
                    "usedWith": null,
                    "fkey": "2~~0"
                },
                {
                    "ftype": 1,
                    "loc": "en",
                    "canEdit": true,
                    "fqualifier": 0,
                    "usedWith": null,
                    "fkey": "1~en~0"
                },
                {
                    "ftype": 1,
                    "loc": "de",
                    "canEdit": true,
                    "fqualifier": 0,
                    "usedWith": null,
                    "fkey": "1~de~0"
                },
                {
                    "ftype": 3,
                    "loc": "de",
                    "canEdit": true,
                    "fqualifier": 0,
                    "usedWith": null,
                    "fkey": "3~de~0"
                }
            ]
    }
}

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

layout

The layout that was used to read the Excel file.

If you did not set the layout when calling this method, this will either be the layout extracted from the file (if it was a prior export) or a default layout.

object

JavaScript errors detected

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

If this problem persists, please contact our support.