> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.athenaintel.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.athenaintel.com/_mcp/server.

# Format Range

POST https://api.athenaintel.com/api/v0/tools/sheets/range/format
Content-Type: application/json

Apply formatting to a range of cells in an Athena spreadsheet.

Reference: https://docs.athenaintel.com/api-reference/tools/sheets/format-range

## Authentication

- `X-API-KEY` header (required) — API Key authentication via header

## Request

### Body (application/json)

This endpoint expects a FormatSheetRangeRequest.

- `asset_id` (string, required) — The ID of the spreadsheet asset
- `end_column` (integer, required) — 1-based ending column index
- `end_row` (integer, required) — 1-based ending row index
- `formatting` (CellFormat, required) — Cell format
- `start_column` (integer, required) — 1-based starting column index
- `start_row` (integer, required) — 1-based starting row index
- `sheet_id` (integer, optional, default: 1) — Sheet ID (defaults to 1)

## Response

### 200

Successful Response

- `asset_id` (string, required) — The ID of the spreadsheet asset
- `message` (string, required) — Success message or error description
- `success` (boolean, required) — Whether the operation was successful
- `new_sheet_id` (integer, optional, nullable) — ID of the newly created sheet when the operation creates one (e.g. duplicate). For rnc-engine sheets this is the engine-assigned id, which may differ from a requested new_sheet_id.

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### CellFormat

- `backgroundColor_hex` (string, optional, nullable) — Background color as hex string (e.g., '#FF0000'). Use either backgroundColor_hex or backgroundColor_theme, not both.
- `backgroundColor_theme` (ThemeColor, optional, nullable) — Background color as theme reference. Use either backgroundColor_hex or backgroundColor_theme, not both.
- `borders` (BordersModel, optional, nullable) — Border configuration for spreadsheet cells. Set individual borders (top, right, bottom, left) to apply borders around cells. Common border patterns: - All borders: Set all four sides (top, right, bottom, left) to create borders around every cell - Outer border only: For a range A1:C3, only the perimeter cells get borders (first row gets top, last row gets bottom, etc.) - Inner borders only: Only borders between cells, not on the outer edges - Horizontal lines: Set only top and/or bottom borders - Vertical lines: Set only left and/or right borders - Single side: Set only one border (e.g., just bottom for underline effect) Note: Borders are applied per-cell. Each cell's border properties control which edges of that specific cell have borders. Overlapping borders between adjacent cells will appear as a single line. Examples: - Box around range: Set all four borders on all cells in the range - Table with grid: Set all four borders to create a complete grid - Underline header: Set only bottom border on header row - Separate sections: Set bottom border to divide content Style names: 'solid' | 'solid_medium' | 'solid_thick' | 'dotted' | 'dashed' | 'double'; the Excel names 'thin' / 'medium' / 'thick' / 'hair' are accepted as aliases. style 'none' (or omitting the edge) leaves that edge without a border — it does not remove a border that is already there.
- `horizontalAlignment` (enum, optional, nullable)
  - Allowed values: `left`, `right`, `center`
- `indent` (integer, optional, nullable)
- `numberFormat` (NumberFormatModel, optional, nullable)
- `textFormat` (TextFormatModel, optional, nullable)
- `textRotation` (CellFormatTextRotation, optional, nullable)
- `verticalAlignment` (enum, optional, nullable)
  - Allowed values: `top`, `middle`, `bottom`
- `wrapStrategy` (enum, optional, nullable)
  - Allowed values: `overflow`, `wrap`, `clip`

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `ctx` (ValidationErrorCtx, optional)
- `input` (any, optional)

### ThemeColor

- `theme` (integer, required)
- `tint` (double, optional, nullable)

### BordersModel

Border configuration for spreadsheet cells. Set individual borders (top, right, bottom, left) to apply borders around cells. Common border patterns: - All borders: Set all four sides (top, right, bottom, left) to create borders around every cell - Outer border only: For a range A1:C3, only the perimeter cells get borders (first row gets top, last row gets bottom, etc.) - Inner borders only: Only borders between cells, not on the outer edges - Horizontal lines: Set only top and/or bottom borders - Vertical lines: Set only left and/or right borders - Single side: Set only one border (e.g., just bottom for underline effect) Note: Borders are applied per-cell. Each cell's border properties control which edges of that specific cell have borders. Overlapping borders between adjacent cells will appear as a single line. Examples: - Box around range: Set all four borders on all cells in the range - Table with grid: Set all four borders to create a complete grid - Underline header: Set only bottom border on header row - Separate sections: Set bottom border to divide content Style names: 'solid' | 'solid_medium' | 'solid_thick' | 'dotted' | 'dashed' | 'double'; the Excel names 'thin' / 'medium' / 'thick' / 'hair' are accepted as aliases. style 'none' (or omitting the edge) leaves that edge without a border — it does not remove a border that is already there.

- `bottom` (BorderModel, optional, nullable) — Bottom border of the cell
- `left` (BorderModel, optional, nullable) — Left border of the cell
- `right` (BorderModel, optional, nullable) — Right border of the cell
- `top` (BorderModel, optional, nullable) — Top border of the cell

### NumberFormatModel

- `pattern` (string, required) — Excel-compatible format string. If omitted, the server will pick a sensible default based on the chosen type (e.g. NUMBER → '#,##0', CURRENCY → '$#,##0.00').
- `type` (enum, required) — Target number format category (NUMBER, CURRENCY, DATE, etc.)
  - Allowed values: `GENERAL`, `NUMBER`, `CURRENCY`, `ACCOUNTING`, `DATE`, `TIME`, `DATE_TIME`, `PERCENT`, `FRACTION`, `SCIENTIFIC`, `TEXT`, `SPECIAL`

### TextFormatModel

- `baselineOffset` (enum, optional, nullable) — Superscript/subscript text positioning (Excel's vertAlign): 'superscript' or 'subscript' to set, 'baseline' to explicitly remove an existing offset (return text to the normal baseline). Omit to leave the current offset unchanged.
  - Allowed values: `superscript`, `subscript`, `baseline`
- `bold` (boolean, optional, nullable)
- `color_hex` (string, optional, nullable) — Text color as hex string (e.g., '#FF0000'). Use either color_hex or color_theme, not both.
- `color_theme` (ThemeColor, optional, nullable) — Text color as theme reference. Use either color_hex or color_theme, not both.
- `fontFamily` (string, optional, nullable)
- `fontSize` (integer, optional, nullable)
- `italic` (boolean, optional, nullable)
- `strikethrough` (boolean, optional, nullable)
- `underline` (boolean, optional, nullable)

### CellFormatTextRotation

- integer
- "vertical"

### ValidationErrorLocItems

- string
- integer

### ValidationErrorCtx

### BorderModel

- `style` (enum, required)
  - Allowed values: `dotted`, `dashed`, `solid`, `solid_medium`, `solid_thick`, `double`
- `color_hex` (string, optional, nullable) — Border color as hex string (e.g., '#FF0000'). Use either color_hex or color_theme, not both.
- `color_theme` (ThemeColor, optional, nullable) — Border color as theme reference. Use either color_hex or color_theme, not both. Defaults to theme color 1 if neither is specified.
- `width` (integer, optional, default: 1) — Border width in pixels (defaults to 1).

## Examples

**Request**

```json
{
  "asset_id": "string",
  "end_column": 1,
  "end_row": 1,
  "start_column": 1,
  "start_row": 1
}
```

**Response**

```json
{
  "asset_id": "string",
  "message": "string",
  "success": true,
  "new_sheet_id": 1
}
```

**SDK Code**

```python
import requests

url = "https://api.athenaintel.com/api/v0/tools/sheets/range/format"

payload = {
    "asset_id": "string",
    "end_column": 1,
    "end_row": 1,
    "start_column": 1,
    "start_row": 1
}
headers = {
    "X-API-KEY": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.athenaintel.com/api/v0/tools/sheets/range/format';
const options = {
  method: 'POST',
  headers: {'X-API-KEY': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"asset_id":"string","end_column":1,"end_row":1,"start_column":1,"start_row":1}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.athenaintel.com/api/v0/tools/sheets/range/format"

	payload := strings.NewReader("{\n  \"asset_id\": \"string\",\n  \"end_column\": 1,\n  \"end_row\": 1,\n  \"start_column\": 1,\n  \"start_row\": 1\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-KEY", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.athenaintel.com/api/v0/tools/sheets/range/format")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"asset_id\": \"string\",\n  \"end_column\": 1,\n  \"end_row\": 1,\n  \"start_column\": 1,\n  \"start_row\": 1\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.athenaintel.com/api/v0/tools/sheets/range/format")
  .header("X-API-KEY", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"asset_id\": \"string\",\n  \"end_column\": 1,\n  \"end_row\": 1,\n  \"start_column\": 1,\n  \"start_row\": 1\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.athenaintel.com/api/v0/tools/sheets/range/format', [
  'body' => '{
  "asset_id": "string",
  "end_column": 1,
  "end_row": 1,
  "start_column": 1,
  "start_row": 1
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-KEY' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.athenaintel.com/api/v0/tools/sheets/range/format");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-KEY", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"asset_id\": \"string\",\n  \"end_column\": 1,\n  \"end_row\": 1,\n  \"start_column\": 1,\n  \"start_row\": 1\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-KEY": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "asset_id": "string",
  "end_column": 1,
  "end_row": 1,
  "start_column": 1,
  "start_row": 1
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.athenaintel.com/api/v0/tools/sheets/range/format")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```