Sushant Peter
Sushant Peter

Reputation: 21

Import data to Google sheet from a live website

I want to import villages data from state government website (Madhya Pradesh State in India). The website is http://saara.mp.gov.in/saaraweb/PublicReport/frm_PerWiseGirdavariStatus.aspx In this page the report is shown off all the district of Madhya Pradesh State. I want to import all the villages data. My target district is "37-सिवनी". The district name is in first column and its position changes according to the percentage of work done by all the districts. When I click on the "37-सिवनी" the javascript shows me all the tahsil(towns) of "37-सिवनी" which are 08. My target town is "06-घंसाैर" its position also changes according to the work done percentage by all towns. When I click on "06-घंसाैर" the list of villages of "06-घंसाैर" is now shown with the desired data I want. I want this data to be imported automatically to my googlesheet in specific time. I tried importhtml and importxml but it did not work for me as the data is not directly available in the url http://saara.mp.gov.in/saaraweb/PublicReport/frm_PerWiseGirdavariStatus.aspx. Do some know how to import data which shows after clicking on some javascript object. It will be very helpful for me. https://docs.google.com/spreadsheets/d/1FfjDh5-z0EIZ5GBOrKElgi3dkRtJX_4BW3imTLUu7ds/edit?usp=sharing In the sheet "want" you can see the type of data I want to import and in "got" sheet is the data what I got when I try to import using importhtml function.

Upvotes: 0

Views: 184

Answers (1)

player0
player0

Reputation: 1

Google Sheets does not support scraping JavaScript content/elements so the best you can have is:

=IMPORTHTML("http://saara.mp.gov.in/saaraweb/PublicReport/frm_PerWiseGirdavariStatus.aspx"; 
 "table"; 1)

0

you can easily test what can be imported simply by disabling JS for a given site like this:

0

Upvotes: 2

Related Questions