Image upload via retool and get url

I have a retool form where people upload their documents.
fileInput1.value[0] take 'jpg', 'png' or 'pdf'
I want the link of the picture to be appended in a google sheet for storage.
I have tried to access the lmage or pdf link with fileInput1.value[0] but it returns

"Your input contains more than the maximum of 50000 characters in a single cell."

Hi @Chilaka,

The file upload button gives you the base64 for your file, but as you mentioned, creating a data url with the base64 is highly likely to exceed Google's limit of 50000 characters. It looks like shorter base64 data urls will still throw an "invalid url" error in Google.

Here are some ideas:

Could you add Google Drive as a REST API resource in Retool, upload the image data to your Google Drive, and then reference that url in your Google Sheets upload query?

What will you use the images for? If you only need to read them in the Retool app, it would be kind of hacky, but you could split the base64 into chunks, save it all to a spreadsheet & then have some logic that combines it all back together in Retool. You need to have enough columns for all of the chunks of base64 text to be appended to your spreadsheet.

1). Write some Javascript that splits your file base64 into smaller chunks, format this data as an object to append to a row in your spreadsheet:

2). Append the data:

3). See the strings of data in Google Sheets:

4). Read the data into Retool & reformat it to a single data url:

Again, if you simply need to read the images in Retool, you could forgo the Google Sheets approach and use our built in database option. This way, you don't have to worry about the hacky logic since you won't hit that same character limit: