Spreadsheet validations

More information about methods to manage the cells validations.

Documentation

The following routes are available to interact with the spreadsheet validations programmatically.

getValidations

Get the validations from a spreadsheet.

GET /api/:guid/validations

setValidations

Set or update the validations for a spreadsheet.

Parameter Description
validations[].index Position of this validation.
validations[].value New validation value.

POST /api/:guid/validations

Examples

Get a new validation object to the spreadsheet.

const baseUrl = 'http://localhost:8009/api';
const guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
const token = 'eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i';
const headers = { 'Authorization': `Bearer ${token}` };

// Request the validations
const data = await (await fetch(`${baseUrl}/${guid}/validations`, { headers })).json();

console.log(data);

Set new validations for a spreadsheet.

const baseUrl = 'http://localhost:8009/api';
const guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
const token = 'eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i';
const headers = { 'Authorization': `Bearer ${token}` };

// Change validation at position 0
await fetch(`${baseUrl}/${guid}/validations`, {
    method: 'POST',
    headers,
    body: new URLSearchParams({
        'validations[0][index]': '0',
        'validations[0][value][range]': 'Sheet1!A1:A6',
        'validations[0][value][action]': 'warning',
        'validations[0][value][criteria]': 'between',
        'validations[0][value][type]': 'number',
        'validations[0][value][allowBlank]': 'false',
        'validations[0][value][value][0]': '10',
        'validations[0][value][value][1]': '30',
    }),
});