Google Sheet Show Image - google-sheets

I'm currently having trouble displaying an image in Google Sheet. I have a Google Form template in which I'm using the FILE UPLOAD function, and I believe the image will be saved in Google Drive, correct?
The responses on the Google Form will be connected on a Google Sheet. So, using Google Sheets, I created a template in which I use the VLOOKUP function to display specific data. When I use the VLOOKUP for the image, it only displays the URL path. Is it possible for me to show it as the image itself?
Upon researching, it says that I need to use =IMAGE() to show an image. However, it seems that it is not working with the =VLOOKUP function.
This is the formula that I used =IMAGE((VLOOKUP(F2,AppData,2,0))) and it only gave me a blank cell.
SAMPLE SPREADSHEET

When VLOOKUP(F2,AppData,2,0) is the URL like https://drive.google.com/open?id=######, in your situation, how about using the following sample formula?
Sample formula:
=IMAGE("https://drive.google.com/uc?export=download&id="&INDEX(SPLIT(VLOOKUP(F2,AppData,2,0),"="),1,2))
or
=IMAGE("https://drive.google.com/uc?export=download&id="&REGEXEXTRACT(VLOOKUP(F2,AppData,2,0),"id\=(.+)"))
By this, the file ID is retrieved from your URL of https://drive.google.com/open?id=###, and the webContentLink is created.
Result:
When your sample Spreadsheet is used, the following result is obtained.
Note:
This sample supposes that your URL is like https://drive.google.com/open?id=###. If the URL is different, this sample might not be able to be used. Please be careful about this.
This sample also supposes that your image file is publicly sharead. Please be careful this.

Related

Google Sheet script finding given URL in page source

I'm looking for a Google sheet script which is able to check is given URL in page source or not.
Something similar to this formula "=IMPORTXML(URL,"//h1")" which is exporting headings from page.
I just need something like this but checking given URL
If you know is it is doable, but it will take much time, I can pay for this.
Use this formula
Make a copy of this sheet.
=IF(ISTEXT(IMPORTXML(A2,"//h1"))=TRUE,"Source","Not a source")

Is there any API available for Retrieve images in the cell from a google spreadsheet?

I'm trying to Retrieve images in the cell from a google spreadsheet. I checked this question is already available. and I also referred to this documentation. But, these both are no longer work. Does anyone suggests me API or provides any good documentation link?
Edited:
This is my Google Sheet. I'm trying to retrieve A4 and A5. Which is I uploaded from local machine. I used this API. But It's given me the blank value. Is there any other API available for retrieving this both images?
You will not be able to retrieve images placed using the "Upload" functionality. To retrieve via API, the image should be placed using
=IMAGE("http://your.url").
So upload your image to a content server, get the URL and insert them to the respective cells using =IMAGE formula.
Now if you retrieve the grid data using Spreadsheet.get and locate this specific element in the array, you will get the cell value as =IMAGE("http://your.url"), you can parse this string to retrieve the image URL.
You can get a zip file with the sheet in html format with all the images – using Google API. I belive it will be easy to parse it and to get the image you need.
Get Your API Key, from Google developers Console
Get a File ID of a google spreadsheet with permissions set to "Anyone with the link".
Now you're ready to call the api (with curl or browser window):
https://www.googleapis.com/drive/v3/files/{FILE_ID}/export?mimeType=application%2Fzip&key={YOUR API KEY}
fill in your FILE_ID and API_KEY from google.
works only with "anyone with link" permissions, otherwise you gotta authenticate first. (more here: How to send google-sheet data in an email keeping the formatting( colors) intact from python?)

Specifying the Title of a new Google Sheet using a URL Parameter (https://sheet.new?title=XXXXXXX)

Is there any way to specify the title of a new Google Sheet document, using ONLY URL parameters?
Example:
The following URL will open a new, blank Google Doc. Where "XXX"
is, you can specify what you want the title of your new document to
be:
https://docs.google.com/document/create?title=XXX
The same goes for creating a new Google Slides document:
https://docs.google.com/presentation/create?title="XXX"
However, if you apply the same pattern to a new Google Sheet, such as:
https://docs.google.com/spreadsheets/create?title="XXX"
This link WILL open a new Google Spreadsheet, but the title is blank.
So it seems this option is not working like the examples that you have provided.
A workaround that you could use is using the REST sheets API. Take a look at create method.
You could integrate this HTTP request in a lot of environment to simulate your behavior.
Alternatively you could report this behavior inside google Sheets itself. This seems like a reasonable request you could make.

Google Sheets embed into website with formatted table

I usually record students marks in a Google Sheet. However Google's embed provides a "mirror" of the Sheets and looks exactly like the sheet. This means I have to resize the cells so as to show the complete names and perform formatting. Is there a better way of displaying this information without resizing the cells. I need a method which automatically displays a the data without any configuration. If possible without the use of Google Apps Script.Here is the sample data. The data will be sent to parents and will also be printed.
https://docs.google.com/spreadsheets/d/1nKcShloX5R4OvhuEtRogCHG18V1YTR5v9Hb19Jobm88/pubhtml
You can use Google Visualizations API. This automatically resizes the cells and produces a neat and minimal looking table.
This is the usage:
https://docs.google.com/spreadsheets/d/<sheet-id>/gviz/tq?tqx=out:html&tq&gid=2
So in your case:
https://docs.google.com/spreadsheets/d/1nKcShloX5R4OvhuEtRogCHG18V1YTR5v9Hb19Jobm88/gviz/tq?tqx=out:html&tq&gid=2
The difference is very clear.

How to produce a print-ready report based on Google Spreadsheet

I have a Google Spreadsheet which stores data filtered from another Spreadsheet which in turn is a sorage of Google Froms questionnaire.
I'd like to produce a print-ready report on a filtered data, retreiving certain data columns and laying it out with some titles, decorations etc.
How can I produce such a report using Google tools?
In this article it explains pretty well how to: Google Apps Script to create PDF.
It made a predefined template of a Google Docs, copyed it and replaced predefined places with the info in the current line of the Spreadsheet, then convert to PDF. If you don't have a predefined length of elements, you can append new info on the documents with the body element.
Take a look at the AutoCrat add-on or Yet Another Mail Merge add-on.

Resources