Google Sheet script finding given URL in page source - google-sheets

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

Related

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.

Performing Google Search In Spreadsheet And Scraping The SERP Data

I hope that you guys are fine. I want to build a simple spreadsheet and I thought I could be able to make one but blank sheet looks horrible to me. I am sure that you guys are kind enough to help me out.
I want to perform multiple Google search queries in Google spreadsheet and want to parse results of each search (top 10 results of each search)
Something like this: https://www.youtube.com/watch?v=tBwEbuMRFlI
But when I tried his given formula in description to play test, Google returned #Error to me, I don't know why.
Can you guys please help me out in making a simple spreadsheet compatible for multiple queries at once? Like one column for keywords (where I could paste my list of keywords) and then 10 columns of search results. All results for one keyword should come in one row
Something like this:
My 1st Example Query = 1st search result, 2nd search result, 3rd result and so on.
My 2nd Example Query = 1st search result, 2nd search result, 3rd result and so on.
It must be easy to code but yeah, it might be time-consuming and I would be very grateful if anyone of you could help me about it.
Looking forward to your help guys.
The problem is that you want to scrape out of Spreadsheets, that's a bad approach and is almost certainly not going to work. Even if you manage to write a scraper inside that limited environment it will easily be spotted by Google.
As you said time is not a problem, I would suggest another route.
Use a backend tool/script that scrapes the data
Use a backend tool/script that creates/modifies the Google spreadsheet
You can run such a script(s) manually on your PC or from a server full automated using a scheduler/cron job.
To create/modify spreadsheets look here: How do I access the Google Spreadsheets API in PHP?
To scrape Google look here: Is it ok to scrape data from Google results?
So this is PHP as language of choice but you can do the exactly same in Java or Python or C#
There is a third party solution like SerpApi you could use for this. It's a paid API with a free trial.
Google Sheets Add-on: SerpApi - Search Engine Results and Ranks
Example code to extract title from the first result:
=SERPAPI_RESULT("engine=google&q=coffee&location=Austin, Texas, United States&google_domain=google.com&gl=us&hl=en", "organic_results.0.title")

Creating a link to download whole spreadsheet from Google Drive

I want to create download link for my spreadsheet on google drive and I read about something like that:
https://docs.google.com/spreadsheets/d/MY_SPREADSHEET/export?format=csv
But it only downloads first sheet. I've read about GID parameter, but I don't want to spend time developing something that will get all GID's from API, and then download every sheet. Is there any way to have one link that leads to download of whole spreadsheet?
You might want to try suggestion in Labnol's guide:
Open your Google Spreadsheet in the browser, make the sheet Public (or Anyone with a link) and make a note of the shared URL. It should be something like this:
https://docs.google.com/spreadsheets/d/FILE_ID/edit?usp=sharing
The direct download links use a similar format as Google Documents and will read like:
https://docs.google.com/spreadsheets/d/FILE_ID/export?format=xlsx
https://docs.google.com/spreadsheets/d/FILE_ID/export?format=pdf
In addition to that, you may want to also try using the suggested URL in this SO post and see if it will help.
https://docs.google.com/spreadsheets/u/1/d/${id}/export?format=csv&id=${id}&gid=${gid}

Google Sheets Spreadsheet Formatting

I'm using Google Sheets and I have a sheet for an eCommerce store's products.
There are columns for description, features, common uses, etc. I need to take features, common uses, etc and merge them into a new cell, and format them using html, so i can easily copy and paste them into my webpage.
I want to wrap html around these echoed values.
Any suggestions? Thanks.
I found the answer myself, in case anyone would like to know:
=CONCATENATE("<p>",CONCATENATE(E10),"</p>")

How can we update a cell in Google Spreadsheet through a URL parameter?

I have a Google Spreadsheet that is intended for public access. However, I'd like to allow for URL parameter(s) through a user's browser that can help modify one or more cells of the spreadsheet before the entire spreadsheet is presented on the screen.
See the example here.
Is something like this possible?
https://spreadsheets.google.com/ccc?key=0AgvcQSA3jj3ydGlQV2E4bndaaWNEbnVqbU5hbk1Va0E&hl=en?B4=8
Can something like the URL above succeed in changing B4 to 8 before the spreadsheet is presented to the requesting user?
See this question. The question
I'm not sure if you can do it and open the spreadsheet with the same link (I've asked a question about that too), but if you read the answer by Serge insas (on the first question linked), mainly edit 2, you'll see how to use HTTP Get to edit cells with a link.

Resources