Style

Manage the cell style using the following routes.

Documentation

Available routes for cell style management.

getStyle

Get the style information from one or more cells.

Parameter Description
cellNames Cell name. If omitted, returns styles for all cells.
index Return the cell's style index or its style.

GET /api/:guid/:worksheetIndex/style/:cellName

setStyle

Apply or remove styles from one or more cells

Parameter Description
styles[].cellName Name of the cell to be styled.
styles[].value New cell styles. If a style property is sent without a value (with just blank spaces), it will be removed.
overwrite If true, removes all current styles from cells before applying new ones.

POST /api/:guid/:worksheetIndex/style

removeStyle

Remove all styles from one or more cells.

Parameter Description
cellNames Comma-separated cell names.

DELETE /api/:guid/:worksheetIndex/style/:cellName

Examples

Set style

Define style to the spreadsheet cells.

const baseUrl = 'https://your-server.example.com/api';
const guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
const headers = { 'Authorization': `Bearer ${token}` };

// Apply new styles to A1 and A2
await fetch(`${baseUrl}/${guid}/0/style`, {
    method: 'POST',
    headers,
    body: new URLSearchParams({
        'styles[0][cellName]': 'A1',
        'styles[0][value]': 'background-color: #333;color:#fff;',
        'styles[1][cellName]': 'A2',
        'styles[1][value]': 'background-color: #ccc',
    }),
});

Reset style

const baseUrl = 'https://your-server.example.com/api';
const guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
const headers = { 'Authorization': `Bearer ${token}` };

// Remove all styles from A1 - use A1,A2,A3 for multiple cells
await fetch(`${baseUrl}/${guid}/0/style/A1`, {
    method: 'DELETE',
    headers,
});