I want to import data from a table from the following page:
https://basketballmonster.com/playerrankings.aspx
When I do so, with all players filter selected, only the top players are imported to my googlesheet. Can someone help me achieve this? Appreciation in advance.
I attached the googlesheet below for your review:
https://docs.google.com/spreadsheets/d/1uvhNp6gBnnEvs8CBb4K7onccew_doFp96wmFEsYyLBk/edit?usp=sharing
Google Sheets can't know what your browser has, so it doesn't know whether you selected which filter. You have to get the same html for Sheets that you have displayed in your browser, which means adding the filter in your query.
Since it looks like the controls aren't passed as parameters in a GET request, sadly it's not as simple as appending
?PlayerFilterControl=TopPlayers to the url.
You have to POST it as a payload with a post request like
{ 'PlayerFilterControl': 'AllPlayers'}.
Sadly Google Sheets IMPORTHTML() doesn't support post request yet, so you'll have to get into apps scripts, request and xml parsing.
I suggest you check out these:
https://developers.google.com/apps-script/reference/url-fetch/url-fetch-app
https://developers.google.com/apps-script/reference/xml-service
Related
I´m trying to take information from a website to googlesheets and I tried with importxml and importhtml, but it´s not working.
https://www.fpf.pt/pt/Jogadores/Ficha-de-Jogador/playerId/1871569
First I tried with Importhtml, only appear the headers:
=IMPORTHTML(A1;"table";1)
A1:
https://www.fpf.pt/pt/Jogadores/Ficha-de-Jogador/playerId/1871569
Result from formula (No Data):
Época Clube Modalidade Escalão
{{item.Season}} {{item.Name}}{{item.Name}} {{item.SportTypeName}} {{item.FootballClassName}}
Then I tried with importxml to appear one column only:
/html/body/form/div[3]/div/div[3]/div[5]/div[1]/div/div/div/div/div[2]/div/section/div/article/div/div/div[2]/div/div/div/table/tbody/tr[1]/td[1]
Result from formula (No data):
{{item.Season}}
Could anyone help me understand what i´m doing wrong?
Thank You Very Much
you will need to find another site with intel you attempting to scrape. the empty table is the result of google sheets not supporting the import of JavaScript elements. you can always check for compatibility by disabling JS in site settings and only what's left can be usually scrapped. in this case its nothing:
I'm trying to import some energy data into a Google Sheet, but can't seem to get the value to appear since it is just text in the HTML line, and shows up as --,--- in the output. I have tried adding /text() to the XPath but that is still not working either.
Website with data to import:
http://www.caiso.com/TodaysOutlook/Pages/default.aspx
Formula in Google Sheets:
=IMPORTXML("http://www.caiso.com/TodaysOutlook/Pages/default.aspx","//div[#class='overview-large-number']")
Also tried the follwoing Xpath with the same --,--- being displayed.
/html/body/div[2]/div[3]/div[4]/div/div/div[2]/div/div[1]/div[1]/div[1]
/html/body/div[2]/div[3]/div[4]/div/div/div[2]/div/div[1]/div[1]/div[1]/text()
Screen Shot of Webpage:
Caiso Webage with Data
HTML Element with Data:
<div class="overview-large-number">41,946 <span>MW</span></div>
Screen Shote of Google Sheets current Output:
Google Sheets Screenshot
Thank you in advanced for any insight.
The data is populated after the page loads, so you can't use ImportXML(). The data is requested via HTTP Get on the URL http://www.caiso.com/outlook/SP/stats.txt and is returned in JSON format.
Get the ImportJSON script from here and add it to your sheet (Tools > Script Editor).
This should be enough to get you started:
=Transpose(ArrayFormula(HLOOKUP(
{"AvailableCapacity","CurrentSystemDemand","todayForecastPeakDemand","histDemand","TodaysPeakDemand","tomorrowsForecastPeakDemand"},
ImportJSON("http://www.caiso.com/outlook/SP/stats.txt"),2,0)))
Note that the Historical Peak value is already a string, so you may have to do some extra work to get the number out.
I have a list of web domains and would like to check if they are built to be mobile-responsive. A fairly sure way to check this manually is to see if there are "#media" queries in the style.css.
I've used XPATH (IMPORTXML) previously to bulk-check for strings on webpages, but I don't see an obvious way of importing the css files in bulk and search for a string within them. Is there a way to do this? Ideally, I'd like to accomplish it in Google Sheets or with Google Apps Script.
Thank you!
You can use Google's Mobile-Friendly Test if you want to use a GUI.
If you want to use a REST API, try this (replace url parameter for what you want to test):
https://www.googleapis.com/pagespeedonline/v3beta1/mobileReady?url=http://facebook.com
This will return a JSON object. It will return lots of useful info, but if you are just looking for mobile friendliness, look for the true or false result here:
"ruleGroups": {
"USABILITY": {
"pass": true
}
Hope that helps!
I'm trying to build a Rainmeter widget that fetches the nearest town to the user and displays it onscreen. I'm currently trying to use the webparser function and this website, but it doesn't seem to be working. The code I've adapted from the example on the Rainmeter website is below - any ideas?
[Rainmeter]
Author=Rainmeter staff
Update=1000
;[WEBSITE MEASURES]===============================
[MeasureWebsite]
Measure=Plugin
Plugin=WebParser
UpdateRate=1800
URL=http://locationdetection.mobi/
RegExp="(?siU)<span style="color:white;">town_city:</span> <b>"(.*)"</b>.*"
[MeasureTown]
Measure=Plugin
Plugin=WebParser
Url=[MeasureWebsite]
StringIndex=1
;[DISPLAY METERS]==================================
[TextStyle]
X=2
Y=17
FontFace=Segoe UI
FontSize=32
FontColor=#454442
StringStyle=Bold
Antialias=1
[MeterTown]
MeasureName=MeasureTown
Meter=String
MeterStyle=TextStyle
Y=2
I'm not sure if it's too late but... your URL doesn't seem to contain any town_city information... at least not in the source code.
Rainmeter reads the raw HTML code from the URL you give to it and processes it through the provided RegEx. Without proper information in the website you can never get it to work.
I am recoding a friend's artist/client booking system. I have little experience in programming, enough understanding to hack my way through and google has been a great help!
I've spent the last 3 days reading and searching... Havn't found anything on that... Maybe I'not using the proper terms....
Here's what I want to do.
I use Google Script and google spreadsheet. 1 row contains all the information about a specific contract.
I want to be able to use a menu item to generate the contract (completed)
Open 2 browser window
one to display the Contract PDF file ( completed )
one for a GMAIL New email
with the contract pdf attached ( completed )
generated email body from selected row in the spreadsheet( completed )
be able to customize the generated email text before
sending it. Adding attachements...
This is what I'm stucked at. I use
MailApp.sendEmail('xxx#yyy.com', 'transfer email as pdf : body
& attachment', 'see attachment', {attachments:[body_to_send]});
It send's the email ok, with attachement and generated body and all... but no way to edit the email before sending...
Is that possible with google script?
Explore the UiApp class in Google Apps Script. UiApp
You could build a simple UI where the user can enter additional content and upload files, which can then be appended to the email before sending.
It doesn't look like Apps Script supports creating email drafts, which would also provide a way for you to edit emails before sending them. (Sending an email to yourself with a fancy way to reference the ultimate recipient is another possibility using the native Gmail UI.)
Is this in the direction you were thinking?
The last step of your process can be achieved using a Google Doc template in which you can add whatever you want to improve presentation.
From there you get an html version of your doc and use it as a html body in your mail.
If you need more details about html import you'll find it easily on this forum and on the issue tracker.
You could also run this code from a document bound script in a sidebar which would be visually more convenient. (see my recent posts about mailmerge).