I am very new to this & I am trying to use the Google Add-On "ImportFromWeb" to scrape NBA Play by Play data into a Google Sheet.
I have inspected the page, but does each item in the HTML code have a separate XPath? I am supposed to be able to paste the link & the Xpath in, but I cannot get the data to load.
I don't think I am selecting the right line? Would anyone be able to tell me which line of code corresponds with the actual play by play data on this site?
https://www.basketball-reference.com/boxscores/pbp/202003110ATL.html
Or any way in general to get this play by play info loaded into a document by using the URL?
Try the following formula which makes use of IMPORTHTML -
=IMPORTHTML("https://www.basketball-reference.com/boxscores/pbp/202003110ATL.html","table",1)
Should get you the display in a sheet that looks like this -
Hope this helps!
Related
I have a client that uses Google forms to take orders and wants to be able to turn the resulting Sheet into a document of Packing Slips. Being a python person I am currently taking her .tsv and making nice HTML printable docs but want to be able to make a plug-in for her so that on any Sheet of this type she can click "Make Packing Slips" and it either opens a new tab with generated HTML (I'm ok using googles templating) or maybe even convert the HTML into a PDF and save it to her drive? Either way I'd rather design the document all in HTML and CSS rather than trying to make a google doc if at all possible. Is the feasible? Any starting points? Thanks!
You need to learn about Google App Script => https://developers.google.com/apps-script/overview
Then these Links should suffice
HTML Service: Create and Serve HTML
Google Container-bound Scripts for Google App Script (Can not post link for this due to low reputation)
I won't bore everyone reading this post with the entire background story of why I need to do this. However, I am looking to load the Google Compose Mail page in the HTML form loaded inside a Google Sheet I have created.
I know the link for the Compose email is https://mail.google.com/mail/u/0/?view=cm&fs=1&tf=1&to=TO&su=SUBJECT&body=BODY
But I don't know if it is possible to have this link loaded as a view in the HTML service Form.
Does anyone know if this is possible and if so, how to do it?
I could always have a button to load the link in a separate tab... but I would like to have this all kept on screen to be more "professional" looking.
I was looking for an option to add an iframe or free code, but option exists. I recommend inserting a form if you are looking for a way to get data from users.
Its under "Insert", then "Form..."
Good Luck
I'm trying to use Google Apps Script to add hyperlinked rows to a GridItem, ideally that act as tooltips. Am I trying to do more than is possible with Google Apps Script?
Here's the situation: I have a GridItem type question that has lengthy row descriptions. To clean up the interface, I'd like to present a short summary of the description that, when clicked/hovered, reveals the full text. To do this, I'd need to turn the short summary into a hyperlink. However, I haven't seen any way to insert hyperlinks in GridItem rows. I thought that Google Apps Script may allow me to do this.
So far, I've tried entering a string followed by .setLinkUrl(), using createAnchor('text', url), using markdown, and actually inserting, as text, <a href='http://google.com'>Google</a>' for the row. Nothing has worked so far.
Is this possible at all?
EDIT:
I apologize - I didn't research this question well enough before posting. Turns out Google Forms auto-detects URLs and posts them as links in the live form. I still have an issue with this, though - I'd rather have some specified text displayed to the user instead of the URL (some of my URLs are lengthy). Anyone know how to do this?
You can design the main elements of the Google form the normal way. Then preview the live form, copy the generated html file, hosted in your website.
Then you can replace the <a>...</a> tag that is generated by Google Form by one you need e.g. <a href='http://google.com'>Google</a>
keep sure you don't disturb any styles or code that may be needed by the Google form to work.
This solution need to have your own web hosting.
You will need to point your users to your website not the live form preview.
I've been struggling with this a while. My script runs from within a spreadsheet to update a site with its data formatted as HTML.
Within the script I'm using app.add(app.createHTML(values[i][j])) within a loop over the data range. I'm also appending various panels within this loop.
At the end I then find the page I want to update in the site and call page.setHtmlContent(app) which obviously doesn't work - what do I need to do here instead?
The object app is a UiApp instance, not an html content. One should consider it more as a command that tells the Google server to generate an html page using GWT toolkit so obviously (as you said) the code you tried can't work.
If you try to get the content of the shown page using something like
var htmlContent = UrlFetchApp.fetch('https://script.google.com/macros/s/AKf------Z1BBusUdHBmbWI-eqNjM/exec').getContentText();
you will see that it looks like anything but an understandable html code , plus you will meet issues with authorizations, warning messages and/or 'loading' messages...
As far as I know there is not way to capture the html content from a webapp in a form that would be compatible with the site method page.setHtml, at least not using Google Apps Script methods.
maybe some hack somewhere but not that I know...
As an example, say I have an image on my page that I need to change every week. Instead of going into the code and changing the picture, I'd like to somehow put a reference to specific cell in a "published to web" google doc in place of my image in the code so I can just change the name of the image in the google doc and the new image will show up on my webpage. I want to accomplish this so I can have several people (who can't code) be able to change the image from their computers. I know it's possible, but I don't even know where to start. Anyone know how to set this up this? Thanks for the help!
One way to do it, when you File > Publish to the web, Google Docs will generate an iframe embed code that looks something like this:
<iframe src="https://docs.google.com/document/d/abcdefghijklmnopqrstuvwxyzabcdefghijklmnopq/pub?embedded=true"></iframe>
You can insert the iframe into your webpage. You can check on "Automatically republish when changes are made" so your users would just need to modify the document when they need to change the image.
However, I'd highly recommend that using a proper CMS would be much better, or at least build a rough authentication and CRUD to update the image.