Google Sheets IMAGE Function

excelbytes

Board Regular
Joined
Dec 11, 2014
Messages
144
Office Version
  1. 365
Platform
  1. Windows
Is there any way to replicate the IMAGE function from Google Sheets in Excel? Maybe a VBA code? From what I can tell, the function in Google Sheets takes a URL and imbeds that image into a cell, not a hovered object like Excel would. The syntax is =IMAGE(url, [mode], [height], [width]). An example pulling in Google's logo is =IMAGE("https://www.google.com/images/srpr/logo3w.png").
 

excelbytes

Board Regular
Joined
Dec 11, 2014
Messages
144
Office Version
  1. 365
Platform
  1. Windows
Dan W, this works great! Man, I wish I had the VBA skills to do this! Is there a way I can compensate you for your effort?
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Dan_W

Well-known Member
Joined
Jul 11, 2018
Messages
789
Office Version
  1. 365
Platform
  1. Windows
No, no, none of that - thank you, though. I'm just glad it works! I'm still not entirely happy with it, though, so will likely tinker with it. It would be great, though, if you could please let me know if you come across any bugs.
 

excelbytes

Board Regular
Joined
Dec 11, 2014
Messages
144
Office Version
  1. 365
Platform
  1. Windows
BTW, I tried the URLs with the old code you had sent and they didn't work either. Is it an issue of jpg vs png? When I paste the URLs in a browser I do get images.
 

Dan_W

Well-known Member
Joined
Jul 11, 2018
Messages
789
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

Hmm - so I tried inserting the photo 'manually' by using VBA (sometimes there are limits to what can be done with a worksheet formula/function), and VBA/Excel reported back that the image wasn't found:
1642099566779.png

Let me look into it.
 

excelbytes

Board Regular
Joined
Dec 11, 2014
Messages
144
Office Version
  1. 365
Platform
  1. Windows
Click on either of the links I sent to you and an image will appear in your browser.
 

Dan_W

Well-known Member
Joined
Jul 11, 2018
Messages
789
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

Yeah - I did see that - they definitely exist, but I just trying to work out why Excel thinks that they don't.
 

Dan_W

Well-known Member
Joined
Jul 11, 2018
Messages
789
Office Version
  1. 365
Platform
  1. Windows
Shouldn't be an issue with png v jpg. They're both supported image types.
Annoyingly, I just realised I used a outdated method inserting images - it still doesn't solve the problem of inserting those two images (which might be an issue re: timeouts, not sure yet), but it is something I need to fix. Will update code in a few hours after dinner. In the meantime, can you please check with other images from different sources to see what does/doesn't work? I had tried a dozen or so using images from blogs (including this forum), but I hadn't tried the Amazon servers.
 

Dan_W

Well-known Member
Joined
Jul 11, 2018
Messages
789
Office Version
  1. 365
Platform
  1. Windows
Ok - it can be done. I've yet to work out why, but Excel doesn't like those two images and won't import them directly into the spreadsheet. It can be done by first downloading the image and then adding it the spreadsheet, but let me dig into it a bit more once I'm back.
 

excelbytes

Board Regular
Joined
Dec 11, 2014
Messages
144
Office Version
  1. 365
Platform
  1. Windows
The option of downloading them first unfortunately won't work for the project I'm doing. I have 1,500+ lines on my report with URLs and I need to pull in the image from the web. Downloading them will add too much time to the process. If that's the only way, then this just may not work. I truly appreciate your time on this. Do you think it's due to the file type png vs jpg?
 
Learn Excel from Bill Jelen

Understanding data is crucial, and the easiest place to start is with Microsoft Excel.

Forum statistics

Threads
1,151,573
Messages
5,765,181
Members
425,266
Latest member
CPAgirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top