There isn’t anything in the grist_api library, so you’ll need to use the API directly: REST API reference - Grist Help Center
In Python:
import requests
response = requests.post(
f"https://docs.getgrist.com/api/docs/{doc_id}/attachments",
files={"upload": open("my_pic.png", "rb")},
headers={"Authorization": f"Bearer {api_key}"},
)
attachment_id = response.json()[0]
cell_value = ["L", attachment_id]
Then use add_records
or update_records
and pass cell_value
as the value of a single cell in an Attachments
type column.