Help

Automatically importing attachments (pics) based on other fields

Topic Labels: ImportingExporting
3792 7
cancel
Showing results for 
Search instead for 
Did you mean: 
Benjamin_Watrou
6 - Interface Innovator
6 - Interface Innovator

I would like to automatically import a .png file (or any pic file type) to an Airtable table, from a Google Sheet cell, to a record’s ‘attachment’ field in the same Airtable table, based on what another Airtable field may contain (e.g. a selection from a single items list). So, if a user selects an option from a ‘single select’ field in an Airtable table, a designated picture from a google sheet populates for that same record in its ‘attachment’ field in the same Airtable table. What is the best way to go about this?

7 Replies 7

Welcome to the community, @Benjamin_Watrous! :grinning_face_with_big_eyes: Adding images to attachment fields can be done via an automation if you know the image URL. The problem becomes getting that URL when the image is coming from Google Sheets.

Would you mind explaining in a bit more detail the relationship between Google Sheets and your Airtable base? How many options will there be in the single-select field? Is it always a 1:1 relationship between that choice and the image that you want to attach?

Thanks for replying Justin!

About the automation of an image via URL. Can the image be automated based on what’s populated in another field, like a conditional formula (If, then statement) or some other method? I’m not looking to import/add more than one image at a time, only one image depending on what’s in a single-select field for each record.

I thought that pulling an image from a Google Sheet would be an efficient way to input owned content into a record via an attachment field. To automate this, I figured it would require an integration like Zapier, Integromat or IFTT, but I’m not sure if those have the exact functionality for this case. The single-select field has about 20 options so far and as mentioned I think it would be a 1:1 relationship (if an item from a single-select field is selected, then a corresponding pic should be the output in an attachment field for the same record).

Not sure if this is possible, but I thought it would be useful, at least in my case :slightly_smiling_face:

As I mentioned in my other comment, this could be done via an automation, but I didn’t mention specifics yet because I wasn’t exactly sure how the Google Sheet tied in. Based on your description, it sounds like it’s just a place to temporarily store the images. While the images might be able to be retrieved from the sheet using a script, there are easier ways to do this. I recommend just posting the images to a Google Drive account. That way you can get a share link for each image, which you can then use in the next step.

A formula field could be used to fill a field with the proper image URL based on the single select choice. Here’s a rough outline of the formula:

SWITCH(
    {Single select field},
    "Option 1", "image_1_URL",
    "Option 2", "image_2_URL",
    "Option 3", "image_3_URL",
    ...
)

Test that formula field to make sure that the proper image URL is appearing with each single select choice. I’ll refer to this field as {Image URL}.

Once that’s done, create a new automation using the “When record matches conditions” trigger. Choose your table, then set the condition to be that {Image URL} is not empty. Test the trigger after choosing a single select option, which will output that option’s image URL into the formula field.

Assuming the test is successful, add an Update record action, choosing the same table as the trigger. For the “Record ID”, choose the ID of the record from the triggering step. For the update portion, add the attachment field, and set its value to be the value of the formula field. Test this action, and you should see the image appear in the attachment field based on your test from the trigger step. Assuming that all is well, turn on the automation.

Sounds good. I’m assuming this is an Airtable Automation? Also, will the output be a link or the actual image? My goal is to pull the images from this field and display them on a web app interface that directly integrates with Airtable.

Yes, this will be in an Airtable automation. By sending the image URL to an attachment field, it downloads and attaches the actual image.

Out of curiosity, what are you using for the web app interface? If you’re just embedding a grid view, this won’t work. Embedded views don’t allow the fields to be edited. It would have to be through a third-party tool of some type.

That sounds even better!
The third-party tool is https://www.softr.io/. Fairly new website, web app, customer portal builder. Very straightforward to use. Heard anything good or bad about it?
Will have to sign off for a little while. Appreciate your tips. Thanks again!

It’s definitely becoming a popular choice, but I have no experience with it so far, so I can’t speak to any specifics about how it interacts with Airtable. I’m going to tag @Narek_Bayadyan from Softr. He can speak more specifically to how well the solution I presented will work for your use case.