Upload Files to Table Cell via API?

I can’t find anything in the docs mentioning it (either how-to, or saying it’s not supported).

Is this possible, yet?

I have found:

Hi @Jordan_Warbelow-Feldstein - It is possible, with some caveats. I should add more of this information to the documentation, so thanks for that reminder.

You can upload files to a table cell using the upsertRows or updateRow endpoints. When specifying the cell value, pass an array of URLs of the files you wish to upload. Below is an example using curl to upload two files to a cell:

curl --request PUT \
  --url 'https://coda.io/apis/v1/docs/<doc_id>/tables/<table_id>/rows/<row_id>'\
  --header 'Authorization: Bearer <api_key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "row": {
    "cells": [
      { 
        "column": "File", 
        "value": [
          "<file_url_1>",
          "<file_url_2>"	
        ]
      }
    ]
  }
}'

The files to upload must be hosted on publicly-accessible URLs. Additionally:

  • The Content-Type header returned along with the file content is used to determine the file type.
  • The Content-Disposition header returned along with the file is used to determine the file name.

Let me know if this helps!

3 Likes

Coda doesn’t read ‘filename*=’ in the content-disposition :

Content-Disposition: attachment; filename="010. trak 10.mp3"; filename*=UTF-8''010.%20%D8%AA%D8%B1%D8%A7%D9%83%2010.mp3

I’m trying to upload files with non-ACSII characters.

1 Like

Hi @Povo_Studios - I’ve never tested that before, but I imagine it could be we never built support for that. Are you seeing the file being uploaded with the filename= value, or no filename at all?

It uses the fallback parameter which is “010. track 10.mp3” not the utf-8 one which is filename*=UTF-8 . . . .

1 Like

Hey @Eric_Koleda I’ve just tried the exact CURL command with a file_url, that is a temp blob storage URL:
https://coda-us-west-2-prod-blobs-upload.s3.us-west-2.amazonaws.com/packsBlobs/c15fd0c0da0fd9046b

where the following response headers is there:

Content-Disposition: attachment; filename="Some_Filename-B4-612185651-0.pdf"

The downloaded filename is something else (69a543e9c741d40…) without .pdf at the end:

Am I doing something wrong, or is there a workaround to keep the original filename?

Edit, Update: I’ve solved it by deploying a proxy that allows to provide a dynamic file name as the last path param (like /download/?url=). Works, but not how it’s intended :grin:

Thanks!

Very strange, I’ve not been able to replicate that behavior. Is there a literal ... in the filename, or was that just you / the screenshot shortening it?

The proxy is a good workaround, but I’d love to fix the root issue if possible.