Spreadsheet Defined Names

Documentation

getDefinedNames

Get the defined names.

GET /api/:guid/definedNames

setDefinedNames

Set defined names.

Parameter Description
definedNames[].name Name.
definedNames[].value Value. An empty string removes the defined name.

POST /api/:guid/definedNames

Examples

Get the defined names

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 defined names
const data = await (await fetch(`${baseUrl}/${guid}/definedNames`, { headers })).json();

console.log(data);

Set the defined names

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}` };

// Set the defined name TEST = SHEET1!A1:B3
await fetch(`${baseUrl}/${guid}/definedNames`, {
    method: 'POST',
    headers,
    body: new URLSearchParams({
        'definedNames[0][name]': 'TEST',
        'definedNames[0][value]': 'SHEET1!A1:B3',
    }),
});