URL for uploaded image


I’ve uploaded images in a column (each row 1 image only) and how could I get the image url in new column?

I’ve tried to get the link via image viewer by right click then “open in new tab” but it will download the image. What I want is, the image display in the new tab when visitor click the link. Is there any formula for the url column to achieve this? or there is any other method?


1 Like

Hi @fa-dale,

Currently, it is not possible, the URL you see int the preview is dynamic, and it is always returned as an attachment. I hope we will change it soon (any PR is welcomed :slight_smile: ).

But with a little help from some external site this can be achieved now. If you have a site, hosted somewhere, that can show an image that is passed as a URL parameter, like this (just a single index.html page):

// index.html
  var img = document.createElement('img');
  img.src = new URL(window.location.href).searchParams.get('url');

You can generate a static URL in a formula column with the following code:

attachment_id = list($YourAttachmentColumn)[0].id
self_url = f'https://docs.getgrist.com/api/docs/INSERT_YOUR_DOC_ID/attachments/{attachment_id}/download'
preview_url = 'https://INSERT_YOUR_SITE_URL.com'
final_url = preview_url + '/?url=' + self_url
return 'link ' + final_url

To share your link with an external user, your document should be public, but you can use Access rules to hide private data.