Search and retrieve images from Google based on G-Sheet value - google-sheets

I'm trying to find a way to find and download automatically images from google images of a lot of products based on their unique code.
This is an example:
Product Code: 976395893
First image I find if i search it on G-Images that I'd like to download locally: https://www.farmae.it/media/catalog/product/import/206984.jpg?optimize=medium&fit=bounds&height=700&width=700&canvas=700:700
Thanks in advance for the support!!!

Related

How to get websites logos with google sheets IMPORTXML with //img/#src?

I have a google sheet list with different companies and their website addresses. I am building a small app in glide and would like to include the companies logo. In my google sheet I want to have a URL to the logo image. Is there any way how I can filter out the other images, that I am getting with //img/#src? Please help me find the function for =importxml(E3,"//img/#src") -->get only logo.
Thank you for your help
my table
For the first one, you can use
=IMPORTXML("https://www.xolo.io/zz-en","//link[#type='image/png']/#href")
No possibility for https://1office.co/ (the website uses javascript)
Third one
=importxml("https://www.firma.de/","//meta[#property='og:image']/#content")
you have to retrieve the specific xpath for each url

Google Sheet Show Image

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.

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?)

How to Get A Company Financials in to Google Sheets

I am trying to get a specific value from a public company's balance sheet into Google Spreadsheet to better analyze the company financials. I want to add the ticker in one of the cells and via a formula, I will get the Total Current Assets for example.
Is there a way to it?
The main issue is that the data is populated after the page is being rendered, so even if I use the IMPORTHTML and set the right XPath I am getting Imported content is empty. It because the value is since it is being fetched on the on a later script.
I found this service which provides the company's financials in a JSON and CSV formats, but I dont know how to parse it on the googlesheet.
Should be something that someone already solved.
Thanks

get spreadsheet URL

I have a problem in my reporting, i create every day a google doc tracker where all the stack holders in my department update their work progress in it, so i have plenty of spreadsheets to monitor which is a hassle, here is what im trying to do, I'm trying to create a big google doc tracker where i can have an access over date applied in the normal spreadsheets, all what i need is the spreadsheet's URLs that exist in my google drive to be retrieved in this big tracker, with this i'll be able to drive all the needed data from the normal trackers.
PS: I'm not good with google scripts.
You can use the Drive Service to get a list of files with MIME type "application/vnd.google-apps.spreadsheet" using getFilesByType. This returns a FileIterator, which you can use to individually get each Spreadsheet file. From there, just use getUrl() to find the URL's. The FileIterator link has examples of how to loop through all the matching files.

Resources