# API : Update a row by adding another file to a file cell

**URL:** https://community.baserow.io/t/api-update-a-row-by-adding-another-file-to-a-file-cell/5975
**Category:** Technical Help
**Tags:** python, api, file
**Created:** [August 27, 2024, 7:48am UTC](https://community.baserow.io/t/api-update-a-row-by-adding-another-file-to-a-file-cell/5975 "2024-08-27T07:48:43Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Nicolas](https://community.baserow.io/letter_avatar_proxy/v4/letter/n/67e7ee/32.png) [@Nicolas](https://community.baserow.io/u/Nicolas)
#### Post date: [August 27, 2024, 7:48am UTC](https://community.baserow.io/t/api-update-a-row-by-adding-another-file-to-a-file-cell/5975/1 "2024-08-27T07:48:43Z")

</div>

Have you read and followed the instructions at: [\*READ ME FIRST\* Technical Help FAQs - #2 by nigel](https://community.baserow.io/t/read-me-first-technical-help-faqs/17/2) ?

**Answer:** I did

#### How have you self-hosted Baserow.

Via docker container, on Ubuntu

#### Which version of Baserow are you using.

1.12.1

#### How have you configured your self-hosted installation?

sudo docker run   
-d   
–name baserow   
-e BASEROW\_PUBLIC\_URL=[http://vision.axe.lan:3001](http://vision.axe.lan:3001)   
-e DATABASE\_HOST=10.0.0.123   
-e DATABASE\_NAME=baserow   
-e DATABASE\_USER=baserow   
-e DATABASE\_PASSWORD=xxxxxxxxxx   
-e DATABASE\_PORT=5432   
-e EMAIL\_SMTP=True   
-e EMAIL\_SMTP\_HOST=176.57.240.1   
-e FROM\_EMAIL=baserow@xxxxxx.xx   
-v baserow\_vol:/baserow/data   
-p 3001:80   
–restart unless-stopped   
baserow/baserow

### Describe the problem

Hi Baserow community !

I have successfuly uploaded a file to a row using the python API. However I couldn’t figure out how to add up files in a single row. Everytime I patch the row, the previous file is being replaced with the new one.

I’m using this function

```auto
def basrw_update_row(
        collaborateur: str = "", 
        row_id: str = "", 
        data = ""):
    token = "QRu6Gu7g7S4gD..."
    url = f"http://vision.axe.lan:3001/api/database/rows/table/371/{row_id}/?user_field_names=true"
    response = requests.patch(
        url = url,
        headers={
            "Authorization": f"Token {token}",
            "Content-Type": "application/json"
        },
        json={
        "Collaborateur": f"{collaborateur}",
        "Fichiers": [data,]
        }
    )
    return response.text

```

#### How many rows in total do you have in your Baserow tables?

3 😄

---

<div class="post-metadata">

### Author: ![frederikdc](https://community.baserow.io/user_avatar/community.baserow.io/frederikdc/32/2086_2.png) [@frederikdc](https://community.baserow.io/u/frederikdc)
#### Post date: [August 27, 2024, 8:10am UTC](https://community.baserow.io/t/api-update-a-row-by-adding-another-file-to-a-file-cell/5975/2 "2024-08-27T08:10:16Z")

</div>

Hi,

If you patch a record, you overwrite the values of all fields mentioned in the body of the request.

To add a file, you first need to perform a `request.get()` operation. This returns a list of files that are already added to the record. Add the new file to the list pass this updated list in the patch request.

---

<div class="post-metadata">

### Author: ![Nicolas](https://community.baserow.io/letter_avatar_proxy/v4/letter/n/67e7ee/32.png) [@Nicolas](https://community.baserow.io/u/Nicolas)
#### Post date: [August 27, 2024, 8:13am UTC](https://community.baserow.io/t/api-update-a-row-by-adding-another-file-to-a-file-cell/5975/3 "2024-08-27T08:13:18Z")

</div>

Crystal clear, thank you Frederik
