Bill_French wrote:
Thanks for sharing the additional requirements. Earlier, you said:
I want to convert attachment URL to base64 string in automation script
This is possible; you simply need to build a base64 encoding function of your own that mimicks atob().
I want the Image uploaded in the attachment column in base64 not the URL
In contrast, this is not possible. The advent of these new deeper insights changes all my answers to simply “no”. :winking_face: Airtable (to the best of my knowledge) doesn’t provide any methods to inject images into attachment fields as base64 files or as any other format for that matter.
@kuovonne might have some deeper knowledge on this topic but I’m pretty sure, however elegant your approach may be, this is not possible.
If you have an image in base64 format and want it to be an attachment in Airtable, you can use an conversion service (like CloudConvert) to convert the raw text into an image file, and then upload the image file into an attachment field.
But it sounds like this is not what the OP wants to do.
It sounds like the OP’s customer will be uploading photos to an attachment field. Scripting app always needs to be run manually, so this won’t work unless you are okay with having a big delay until someone can push that button. Also, the base64 version of an image is likely too large to fit in a long text field. You would have to generate a text file with the base64 info at a public url, and then move that file to a different attachment field. That’s too complicated.
Interestingly enough, the code int the Web Dev link that Bill shared actually works in Scripting app, although the editor complains that it doesn’t know what a FileReader is. On the other hand, the exact same code doesn’t work in an automaton script. You can create the FileReader, but FileReader.readAsDataUrl is not supported.
This sounds like the best option.