# Replace a spreadsheet

> PUT https://api.nabrah.ai/api/ext/document/{document_id}/file

Group: Documents. Page: https://www.nabrah.ai/en/docs/api-reference/documents/replace-a-spreadsheet

Replaces the file of an existing sheet document with a new CSV or Excel file (up to 2 MB and 10,000 rows) and ingests it again. Omit `sheet_desc` or `searchable_columns` to keep the current values; send an empty list `[]` to let the agent search every column.

## Authorization

- `X-API-Key` (string, header, required): your workspace API key.

## Path parameters

- `document_id` (string, required)

## Body (multipart/form-data)

## Response

### 200 Successful Response

Content type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000",
  "knowledge_base_id": "00000000-0000-4000-8000-000000000000",
  "type": "file",
  "status": "unknown",
  "title": "string",
  "summary": "string",
  "filename": "string",
  "created_at": "2026-01-15T12:00:00.000Z",
  "updated_at": "2026-01-15T12:00:00.000Z",
  "source_format": "pdf",
  "tabular_schema": {},
  "sheet_desc": "string",
  "searchable_columns": [
    "string"
  ]
}
```

### 422 Validation Error

Content type: `application/json`

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}
```

## Request examples

### cURL

```bash
curl --request PUT \
  --url 'https://api.nabrah.ai/api/ext/document/<document_id>/file' \
  --header 'X-API-Key: <your-api-key>'
```

### Python

```python
import requests

url = "https://api.nabrah.ai/api/ext/document/<document_id>/file"
headers = {"X-API-Key": "<your-api-key>"}

response = requests.put(url, headers=headers)
response.raise_for_status()
print(response.json())
```

### JavaScript

```javascript
const form = new FormData();

const response = await fetch("https://api.nabrah.ai/api/ext/document/<document_id>/file", {
  method: "PUT",
  headers: { "X-API-Key": "<your-api-key>" },
  body: form,
});

const data = await response.json();
console.log(data);
```

### Go

```go
// Send multipart/form-data with mime/multipart:
// PUT https://api.nabrah.ai/api/ext/document/<document_id>/file
```
