How to add Images to a table in Google Data Studio
In this post I’ll show how you can add images to a table in Google Data Studio.
I need to thank Lee Hurst @Helpfullee for introducing me to this method. I came across it in his excellent Data Studio Resource finder.
If you’re interested in this topic you should take a look at ClickInsight’s very good post on the topic, as well as Google Data Studio’s information on adding images.
After some thinking I decided to do something a bit fun with these images, and use them to display the album covers of the Prodigy. Each image is based on a link to the album cover image filed on Wikipedia.
How to add Images to a table in Google Data Studio
For this Data Studio report I decided to create a table in Google Sheets with some simple information about the Prodigy’s studio albums.
This was the Album title, Release Date, number of UK sales, the AllMusic Rating and (importantly for this post) the Image URL.
I then added my table as a data source to a new Data Studio report.
The next step is to create the Image field that we want to have.
The formula for this is fairly simple:
IMAGE(Image URL, [Alternative Text])
Parameters:
Image URL – a field or expression that evaluates to a URL.
Alternative Text – (optional) a field or expression that evaluates to Text.
For our Prodigy post, we’ll use a formula like this:
IMAGE(Image URL,Album)
Therefore the image will be based on the link to the album cover, and the alternative text will be the Album name.
Now that we’ve created our Image dimension our data should look this this:
We can then go into our presentation and add a table with the data set up like this:
And then our table should look something like what is shown below.
Hope this was useful!
Download Google Data Studio Templates
If you’d like to download one of my Google Data Studio reports as a template to use for your own data, you can visit Data Studio Templates and purchase one.
Hi! Thanks for this explanations. But could you tell us how we add several images?
I did exactly what you explained and it works for one image, when I create a second image field, the result is not what I expect… The images are not in the good fields…
Im not sure it’s clear, but if you can help me it would be great 🙂
Thanks, Pauline
Hi Pauline. Check to make sure the link to the second image is valid. Needs to link directly to the image file. It is possible to have multiple images in a row in a table.
Localize the image you want on google-drive, click one time in the image, in case the info of the image is hidden, click in icon ( ℹ ) in order to show details of the image. Notice that a copy of the image will appear then click on it with right button and copy the image address and then paste it in the desired field, where data studio will present the desired image, note that copied address is different from original ID.
correction
Your comment is awaiting moderation. This is a preview, your comment will be visible after it has been approved.
28 Nov 2020 at 1:20 pm
Localize the image you want on google-drive, click one time in the image, in case the info of the image is hidden, click in icon ( ℹ ) in order to show details of the image. Notice that a copy of the image will appear then _press shift key_ and click on it with right button and copy the image address and then paste it in the desired field, where data studio will present the desired image, note that copied address is different from original ID.
How do you manage to import all of the url for a large number of images??
Obviously if I have to do it one at a time I won’t!
Thanks
Depends on where you’re getting the images from?
Hi there! I’ve added the URLs but the images aren’t loading. The link is from my google drive (the link has editor access). Any clue why this may be happening?
Hi – yes. There is an issue with linking images from Google Drive. For some reason it does not allow it. I’d recommend creating image folders using Imgur (you can set the folder setting to Hidden).
Otherwise if it has to be from Google Drive try the following (I haven’t tried this myself).
Here is a script you can add onto a google sheet that will read all the files in the folder and create the image links and thumbnails etc for them . I created it for a project at work – also makes reviewing images in a Drive folder a nicer experience using a simple data studio
function listFilesInFolder() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var SSID=ss.getId();
var fileInDrive = DriveApp.getFileById(SSID);
var parentFolder = fileInDrive.getParents().next();
var parentFiles = parentFolder.getFiles();
var parentName=parentFolder.getName();
var file;
var data;
var sheet = ss.getActiveSheet();
sheet.clear();
sheet.appendRow([“Name”,”thumb URL”,”ID”,”Date Created”, “URL”,”Download URL”, “Type”, “Last Updated”, “Parent Folder”]);
// Every file in the folder containing this file.
while (parentFiles.hasNext()) {
file = http://parentFiles.next();
data = [
file.getName(),
“https://drive.google.com/thumbnail?id=”+file.getId(),
file.getId(),
file.getDateCreated(),
file.getUrl(),
file.getDownloadUrl(),
file.getMimeType(),
file.getLastUpdated(),
parentFolder.getName()
];
sheet.appendRow(data);
}
};
Localize the image you want on google-drive, click one time in the image, in case the info of the image is hidden, click in icon ( ℹ ) in order to show details of the image. Notice that a copy of the image will appear then click on it with right button and copy the image address and then paste it in the desired field, where data studio will present the desired image, note that copied address is different from original ID.
correction
Your comment is awaiting moderation. This is a preview, your comment will be visible after it has been approved.
28 Nov 2020 at 1:20 pm
Localize the image you want on google-drive, click one time in the image, in case the info of the image is hidden, click in icon ( ℹ ) in order to show details of the image. Notice that a copy of the image will appear then _press shift key_ and click on it with right button and copy the image address and then paste it in the desired field, where data studio will present the desired image, note that copied address is different from original ID.
Hi, Michael. I’m trying (-and failing) to add images to my table in Data Studio from Sheets. Since I saw your comment re: bug in Drive, I tried imgur — but my images are still not loading 🙁 I also tried getting the link from flaticon but to no avail. Do we have any other work around for this?
Hi Celestine.
It’s odd that the images from imgur are not working. I’ve never had a problem.
What type of file are they?
And are you linking directly to the .jpg or .png file?
Hy celestine! For linked images, we are using blogger.com. Try uploading them to this platform and then tell us if it has worked. Good luck!!
Hello!
Is possible resize the image? For example I would like use a small picture (a circle check), but in table the image looks big.
you have to adjust the size of the column in the table to resize the image
I need to display just a list of images on one of the report pages – left to right, top to bottom. Is it capable of doing so?
Is there a way to have multiple images within a case statement and have the image chosen based on criteria? I have put this but it seems to think the IMAGE() function is just text.