Can't display image in G sheets cell using Vlookup to get the link (returns blank or error) - image

I have a Google sheet with answers to a form, and I created a template in Google Sheets to transform each row in the answers sheet in a report, using vlookup (=PROCV in portuguese). The last column in the spreadsheet is a link for an image, uploaded by who answered the form.
The vlookup is working fine, except for the image. It's not displaying the image in the cell.
I have tried:
=image(PROCV(H7;'Respostas ao formulário 1'!1:630;21))
It returns a blank cell.
and also
=IMAGE("https://drive.google.com/uc?export=download&id="&INDEX(SPLIT(PROCV(H7;'Respostas ao formulário 1'!1:630;21),"="),1,2))
and
=IMAGE("https://drive.google.com/uc?export=download&id="&REGEXEXTRACT(PROCV(H7;'Respostas ao formulário 1'!1:630;21),"id\=(.+)"))
which I found here in stackoverflow, in another question about this issue, and return an "ERROR".
Also important, I've already changed permissions in the image (anyone with the link can access).
Any insights, please?
Thank you in advance for your time and attention.

If http://drive.google.com/uc?export=download&id={file_id} does not work, try this format:
Link Format:
http://drive.google.com/uc?export=view&id={file_id}
Try this publicly available image:
http://drive.google.com/uc?export=view&id=1YEpZitKgY6YT0TMDvOX4uqoxD5_aTuEv
Raw link image formula;
=image("https://drive.google.com/uc?export=view&id=1YEpZitKgY6YT0TMDvOX4uqoxD5_aTuEv")
Formula using regexextract to get file ID:
=Image("http://drive.google.com/uc?export=view&id="&REGEXEXTRACT(VLOOKUP(H7,'Respostas ao formulário 1'!1:630,21),"id\=(.+)"))
Outputs:
Vlookup output:
http://drive.google.com/uc?export=view&id=1YEpZitKgY6YT0TMDvOX4uqoxD5_aTuEv
Regexextract output:
1YEpZitKgY6YT0TMDvOX4uqoxD5_aTuEv
Raw link image output:
Image regexextract output:
Note:
If the image is still not showing, there is an issue with your link and it may not be available to anyone else. To confirm this issue, open the link in incognito mode. If it shows, it is publicly available. If not, then it isn't and the image will not show using IMAGE formula.
Make sure the one you append to the link format is only the ID and nothing else.
See sample sheet
EDIT:
It seems your lookup ID contains #, add a backslash before it by using the below formula
Formula:
=Image("http://drive.google.com/uc?export=view&id="&REGEXEXTRACT(VLOOKUP(regexreplace(H7; "#"; "\#");'Respostas ao formulário 1'!1:630;21);"id\=(.+)"))

Try setting the "is_sorted" parameter to false. From your first formula I gather you are looking up the value in H7 against the sheet 'Respostas ao formulário 1' rows 1 through 630 and you want the 23 column (W). Some areas that can give you problems is setting the sort to false, so it has to be an exact match, is the lookup value in the first column of the resource sheet?
Essentially with a format matching this you shouldn't have any issues:
Sheet named 'Respostas ao formulário 1'. Notice I have hidden columns B:V to consolidate the image and only show important information.
Finally the formula sheet:
We are looking up the value in cell F1 "Value1" against the second sheet and returning the image from the link.

Related

How do I address the current cell in a formula vs typing in the cell name (Ex: A2)?

I'm using the =IMPORTRANGE formuala to pull values from another spreadsheet and represent them in a comparison chart on another sheet. Here is the formula below.
=IMPORTRANGE("the link to my doc is here", "Wed. HEADCOUNT!C2")
^^^ this formula currently works. What I'd like to do is replace C2 with "currentcell" but this breaks the formula. I need to do this to repaste the formula hundreds of times without having to individually change each one.
Any thoughts?
I've tried putting in "currentcell", but this led to #REF error.
You can create a "virtual" reference to your current cell by using CELL("address",C2), which returns the address "C2", and then C2 will move when you copy the cell to another location.
So your formula will be this:
=IMPORTRANGE("the link to my doc is here", "Wed. HEADCOUNT!" & CELL("address",C2))

AppSheet + Spreadsheet: AppSheet won't display formulaically generated image

I am stuck on this problem and request your guidance. Appreciate it in advance!
I am trying to display QR code images on the Appsheet. The images need to come from spreadsheet where they are stored in a column named QR code. The QR codes are unique for each row and are formulaically generated by an array formula in the first row of this column like this:
=ArrayFormula(if(isblank($A$2:$A), "", image("https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl="&$A$2:$A)))
In the appsheet I have tried making this column of type image, drawing, thumbnail etc. But none of it is working.
I read somewhere that such dynamically generated images don't work with appsheet. It would be really a bummer for me.
I also explored an option to add one more column in the spreadsheet where the image.png could be statically stored somehow. But I was not successful in that.
It would be really great if you could please help me solve this problem.
Thank you so much folks!
Just use the formula in your spreadsheet
=ArrayFormula(image("https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl="&$A$2:$A))
https://www.youtube.com/watch?v=hrfPldfrOcc

Google Sheet how to determine if a cell has an image and if not insert my image

So i'm using importxml to get images from a website. Since image links in this website are truncated i'm successfully using this method:
In cell A1 i put main domain link : https://imagedomain.com/
In cell A2 i pull truncated image links with this formula:
=TRANSPOSE(query(importxml(B1 **(here image page link)** ;"
(/a/img/#src) |
(/a/img/#src) |
(/a/img/#src) ")))
(I import many images but in this example concentrating just in one cell and trucated links just show like text in cell similar to this: img/1234.jpg)
In cell A3 i united A1 and A2 with this formula:
=(A1)&(A2)
(This unites main domain with truncated image link and gives this: https://imagedomain.com/img/1234.jpg)
In cell A4 (last step) i show image with this formula:
=image(A3)
Now my problem is that sometime imported truncated link in A2 does not exist because that website offers no image but i still have a formula and link in A4. This is a problem because i can't use if blank to replace with one of my images.
My question is if there is any formula detecting if image shows and if not to insert my own image. I don't want to use any script.
I tried to explore if #alt because that website offers alt for every image but i don't know exactly how to do that. So my idea was if link + alt then verifies that there is image but if no alt then no image imported and then insert my image. This is just my idea how this could be solved ONLY with formula but maybe there are other and easier ways. Thnx
this may work:
=(A3<>"")*(NOT(ISTEXT(A3)))*(NOT(ISNUMBER(A3)))=1
but note that you would need to use all possible states to really make sure ...so:
=ISNONTEXT(A3)*
(NOT(ISBLANK(A3)))*
(NOT(ISNUMBER(A3*1)))*
(NOT(ISERROR(A3)))*
(NOT(ISTEXT(A3)))*
(NOT(ISFORMULA(A3)))=1
UPDATE:
try:
=INDEX(IF(COUNTIF(QUERY(LOWER(IMPORTXML($A$1; "//img/#alt"));
"where not Col1 matches '.*calendario.*|.*commenta.*'"; 0);
REGEXEXTRACT(LOWER(C3); "\d+ (.*) \("))*1=0;
IMAGE("https://i.imgur.com/RkXY3DB.jpg");
IMAGE("https://tv.zam.it/"&QUERY(QUERY({LOWER(
IMPORTXML($A$1; "//img/#alt"))\ IMPORTXML($A$1; "//img[#alt]/#src")};
"where not Col1 matches '.*calendario.*|.*commenta.*'"; 0);
"select Col2 where Col1 contains '"&
REGEXEXTRACT(LOWER(C3); "\d+ (.*) \(")&"'"; 0))))
spreadsheet demo
Try this... First check if your image returns text when using
=IMPORTDATA(A1)
If yes
Use this:
=IF(ISTEXT(IMPORTDATA(A1)),IMAGE(A1),"There is no Image there")
If no use this:
=IF(ISTEXT(IFERROR(IMPORTDATA(A1),FALSE)),IMAGE(A1),"There is no Image there")
A1 = is the Image URL (https://....jpg)

Google Sheet & App Script : how to get image from a link preview?

I am trying to reproduce a RSS reader like Feedly with Google Sheet and displaying with Glide as an app on my mobile phone.
Everything's fine with IMPORTFEED() function with titles, description, URL.
But it seems this function doesn't allow pictures to be displayed even if they are in the feed (which is not all the time).
So I am looking for a way to extract the main image from a blog post... the one displayed when you hover on a link in a Google Sheet cell.
I would like to get the link of that image displayed in the link preview and put that link in another cell.
Here is an example:
I tried IMAGE()
and also IMPORTXML when there is an image in the RSS feeds (but not all of them do... so I stopped)
Is it possible in Google Sheet to get the main image from the one displayed in the link preview ?
For instance, one of the blog I want to extract the main picture of a blog article would be Creajv (URL : https://creajv.com/ ; Feed : https://creajv.com/feed/)
So the IMPORTFEED() function I did in Google Sheets was :
=IMPORTFEED("https://creajv.com/feed/";"items";FALSE;3)
Which stands for :
=IMPORFEED(...) the function to import feeds from an URL
"items" the way to pull every data there is in the feed (you can use other parameters and can see all the possibilities on the GoogleFormulas documentation)
FALSE because I don't want the headers to be included
and the number 3 because I want only the last 3 results displayed.
And it displays perfectly : author, description, URL, date
But I did a little digging in Google and found that basically IMPORTFEED() cannot get images from feeds, even if it is added by the author of the blog (he has to add a feature to do it).
So I am now trying to see if there is another way which is not IMPORTFEED() to get every time the main image of a blog post.
And I saw Google Sheet is able to pull instantly it when I copy paste the URL of a blog article within a cell for instance for Creajv :
Print screen of the image I get when I click in the cell which contains the post URL
So my thoughts would be that I can pull the author, date, description etc. with IMPORTFEED (which works perfectly every time) and use a formula on the cell with the URL to get in another cell the URL of the picture pulled from the one in the link preview.
Two other possibilities might also be with Google App Script :
creating with the App Script a custom function
or creating a script pulling the image in a cell every time a new row is added via the IMPORTFEED() function.
Functions only, as Apps Script doesn't run on mobile Apps
How about this solution? I checked the website and inspected the image from the thumbnail.
Luckily, the structure is simple:
<div class="article-image">
<img src="https://creajv.com/wp-content/uploads/2020/11/HighresScreenshot00000.png" alt="Concours de Level Design avec Unreal Engine, du 11/11 au 05/12/2020">
</div>
You can get the url with IMPORTXML, and apply IMAGE to it:
=IMAGE(ImportXml("https://creajv.com/2020/11/08/concours-de-level-design-avec-unreal-engine/", "//div[#class='article-image']//img/#src"))
Since you are already retrieving the post url with your previous formula, change the source url by the correspondent cell:
=IMAGE(ImportXml(C1, "//div[#class='article-image']//img/#src"))
For example:

Google spreadsheet formula for url with a variable

What's the formula to display an url in google sheet when part of said url is a variable from another cell?
I'll explain: in one cell I have this formula (used to scrape text with class 'description' in an html webpage, doesn't matter for the purpose of the question though)
=importXML("http://www.xxx.it/code/9788823506183/doc/book.html","//span[#class='description']")
The numerical part changes everytime based on the value in another cell, say B3.
Tried =importXML("http://www.xxx.it/code/(B3)/doc/book.html","//span[#class='description']") but of course it won't work.
Then I thought I could dinamically create the url in B2 and do like this:
=importXML("B2","//span[#class='description']")
One step closer but I'm stuck anyway, how can I generate such url in B2? I can't find a suitable function in the docs. I could only come up with:
in A1 = 9788823506183
in B2 = http://www.xxx.it/code/("A1")/doc/book.html but it's not the correct syntax. :(
In Excel, you'd do something like the following. Give it a try in a google spreadsheet.
=importXML("http://www.xxx.it/code/" & B3 & "/doc/book.html","//span[#class='description']")
Use CONCAT in Google Sheets.
=CONCAT("http://www.xxx.it/code/(", $B2,")/doc/book.html")
You may need a formula to get the exact spot in the string.
The following example starts a timer based on a cell value but could be adapted to build a URL out of any cell values. Assume that there is a number of minutes that you want to make a timer for is in $C20
1) Make a cell that builds the first part of the URL, in my case $E27:
=CONCAT("https://www.google.com/search?q=set+timer+for+", $C20)
2) Make a second cell that completes the URL, in my case $E28:
=CONCAT($E27,"+minutes")
3) Make a cell that contains a hyperlink that will call up the timer:
=HYPERLINK($E28, "Start a timer for cell value C20")
Then when you click on the cell you made in #3 a hyperlink will hover over and you can click on it.

Resources