I’m importing a table from Airtable to Grist and would like to import all the attachments for it as well.
Step 1
Use a formula to change the field value into the full url, using a transformation.
if $screenshots:
return REGEXEXTRACT($screenshots, "https[://a-zA-Z0-9._-]*")
else:
return None
Step 2
Copy the attachment resulting URL to a new attachment column, by using a formula to fetch the Url from the other field.
if $airtable_screenshot_url:
return [$airtable_screenshot_url]
else:
None
Step 3
Try to view the resulting image on a widget, on the same page as “card list”
I’m not sure how to do this. Can anyone help? See the screenshots to see what I’ve tried. Why is it trying to find the image externally instead of looking inward at what files Grist is storing?
Also I’ve read the other related thread.
Hi @desbest.
Just to confirm, you’d like to view your Airtable attachments with the Image Viewer custom widget? The attachments are currently stored at Airtable, and not within your Grist document. (These are URLs containing airtableusercontent.com
.)
If that’s accurate, then I think the issue is your last formula - you can just use the column $airtable_screenshot_url
for the Image URL and it should load your image. There’s no need for your last formula that wraps the URL in square brackets.
If you’d like those attachments to actually be stored within the Grist document itself, and not at Airtable’s servers, you’ll need to export/download them from Airtable first, and then add them to an Attachments column in Grist. Attachments columns show a thumbnail of all of the attachments in each cell, so it works a bit different than the Image Viewer widget.
George
Is there a way to bulk import them, by fetching the URL remotely?
Grist does have an API that lets you upload attachments. A script could go through the list of URLs, download each one individually, and then upload each one to Grist via the API. I don’t think anyone has written and shared such a script yet though, so it would require some effort and knowledge of programming.
Does Airtable provide any way for you to bulk export all of your attachments as files (and not URLs)? If yes, the link from your original post has a workaround on how you might be able to bulk import the attachments into Grist.
George
I think that I’ll use the API later this month, for now to code a script.
A few months later, I’ll look into converting my script into a plugin so that anyone can use it within the Grist interface.
Thank you for your help!
1 Like