Retriving price from a page - google-sheets

I am trying to retrive the price from a custom search Page in google sheets using importxml() but i have an empty result error
=IMPORTXML("https://starcitygames.com/search/?hawksearchable=card_nametext%3A+%22Shaman%20of%20the%20Great%20Hunt%22+AND+search_includetext%3A+%22default%22&language=English&filter_set=Fate%20Reforged&finish=Non-foil","/html/body/div/div[1]/main/main/div[7]/div/div[2]/div[2]/div/div[1]/div[1]/div[2]")
Formula
This is an example

It looks like the results in that HTML page are generated in your browser using JavaScript. Google Sheets does not run JavaScript so it never sees the HTML that you see in the browser. See https://www.reddit.com/r/googlesheets/wiki/import-html-xml/ for more information and a possible way forward.

Related

IMPORTHTML-function in Google Sheets pulls wrong data

I am trying to scrape the current gas prices in a German city by using the IMPORTHTML-function in Google Sheets. The function seems to work, at least the data is being imported into my sheet. When taking a closer look, one recognizes, that the data inserted into the sheet differs from the current data displayed on the webpage I am scraping.
This is the function I inserted into my Google sheet:=IMPORTHTML("https://www.benzinpreis.de/aktuell/super_e5/deutschland/nordrhein-westfalen/koeln/koeln/koeln"; "table";4)
I took a screenshot of the differing values:
Does anyone have an idea where I made a mistake?
You may consider using external tools which can render JS website OR debug if the website makes some AJAX call, and get raw JSON instead of trying to fight with HTML.
It looks like the website uses this xhr request to get the actual data in JSON:
https://www.benzinpreis.de/bpmap-callback.php?lat_min=50.86707808969461&lat_max=51.01850632466553&lng_min=6.700286865234375&lng_max=7.215270996093751&action=getTankstellen
( see Chrome Dev Tools Network tab for detailed information )
then you might use ImportJSON to import data into your Google Sheet.
https://workspace.google.com/marketplace/app/importjson_import_json_data_into_google/782573720506
Discovering hidden APIs using Chrome Dev Tools:
https://www.youtube.com/watch?v=kPe3wtA9aPM

Looking to import HTML information into a Google sheet

After multiple test and research I don't have success in importing the data of this table (div) into a Google slide.
None of the formula I tested actually work included this simple test to extract the first column/line "Name":
=importxml("https://ecosystem.lafrenchtech.com/lists/18872/list?showGrid=false", "//span[#class='table-column-text']")
:(
Anyone could help me ?
Thx by advance.
Answer:
I've tested your function on a test sheet and it returns an empty content.
According to an answer at Google Sheets importXML Returns Empty Value , IMPORTXML can not retrieve data which is being populated by a script and it is a limitation. Unfortunately, I have checked that when Javascript is disabled for the ecosystem.lafrenchtech.com site in Chrome browser, the table never loads. Thus, this confirms that the table is being populated by a script and this is the reason why it returns an empty content.
A possible alternative solution is to check if the ecosystem.lafrenchtech.com offers an API, where you can directly get the data that they show from their table using an API key (if it is available). However, this will require you to use Apps Script to parse the data from their API and then post it on your spreadsheet, which would be quite a tedious for a quite simple process.
Note:
On your post, google-slides was the set tag.

How to populate a google sheet template with response data from a google form?

In the past I used an add-on that allowed me to generate a google sheet corresponding to a google form response. However, the add-on that I was using has a limit to the number of documents that can be created, and I was hoping to find an alternative.
Is there another way to take each response I receive in the google form and then generate a google sheet?
Nowadays you can generate a Google Sheet with the Google Form's responses by clicking on View Responses in Sheets button while on the Responses tab:
This should generate a sheet like this:
You can also configure this behavior on this page:
Choose where to save form responses

Scraping a web Page in Google Sheets

I need to scrape the content of the page:
https://www.otcmarkets.com/stock/GBTC/security
in a Google spreadsheet, so that I can further elaborate that.
I failed miserably,
can you help me?
Thank you!
If you want to scrape a web page in Google Sheets, you might benefit from making use of one of the formulae below:
IMPORTHTML which is used to import data from a table or list within an HTML page;
IMPORTXML which is used to import data from any of various structured data types including XML, HTML, CSV, TSV, and RSS and ATOM XML feeds.
However, if the content you want to retrieve is dynamic, you might need to look for other alternatives as both of these commands read the HTML source of the page without any JavaScript code associated with it and without executing it.
Reference
Google Sheets IMPORTHTML;
Google Sheets IMPORTXML.

Not able to fetch website data using Importxml in Google Sheets

I am trying to fetch this website (https://www.covidhotspots.in/?city=Mumbai&source=share) data using Importxml in Google Sheets but it gives me no data.
I am trying to apply below formula but it is giving me #NA
=IMPORTXML("https://www.covidhotspots.in/?city=Mumbai&source=share","//li/text()")
I want to fetch geocodes as mentioned in the below images
Issue
IMPORTXML can only read the HTML source of a website. Therefore, those elements and components of a website added dynamically will not be able to be retrieved by the IMPORTXML.
If in your browser you take a look and view the source of the website, specifically focusing on the parent ul element that contains the li that you want to retrieve, you will find that the ul element is empty. This is because the children are inserted dynamically throughout a Javascript script (and that is why when you call this IMPORTXML accordinly to that ul nothing is returned, because it is empty in the source HTML).
Possible workaround
Sometimes, in the Javascript files of the website, you can find out the URL of the source of data being inserted dynamically but that is a tedious task to achieve.
I hope this has helped you. Let me know if you need anything else or if you did not understood something. :)

Resources