Making Google Scripts & Google Sidebars Talk

flickr photo shared by Internet Archive Book Images with no copyright restriction (Flickr Commons) Sometimes you want a Google Sidebar element to be able to pull variables from a Google Script. The key element is google.script.run.withSuccessHandler. I’m still not entirely sure I have this in my head deeply/correctly but this is functional and might help someone else (even if that someone is just me at a later point in time when I’ve forgotten this). This one sets some default times based on spreadsheet variables stashed elsewhere and then automates some date/time entries using the form sidebar. Sidebar Code Google Script Code The entire sidebar/script setup is below in case anyone cares for some reason. Pick Your Date Start/End Times Start: End: Hide Previous Dates Submit

Google Sheets Love – REGEXEXTRACT & IMPORTFEED

flickr photo shared by CraigMoulding under a Creative Commons ( BY-SA ) license Just two little functions in Google Sheets that came up as we tried to quickly pull comments from a blog for some other work. It was an odd scenario but the techniques should have other useful applications. IMPORTFEED The function below pulls my 10 most recent comments into a spreadsheet. You can set it to pull more but will also need to change the number of items in your RSS feed. You can find that setting under Settings>Reading. It’ll work on any RSS feed and there are a variety of other IMPORT functions that are worth checking out. This could be a useful option if you wanted to analyze the comments in one place or if you wanted to look a bit more deeply at comments on sites you don’t control. 1 1 I had to switch this to code because copy/paste led to issues with quotes messing up the formula.

Private Comments via XMLIMPORT

Making shareable (Sharing with a single person or specific group but not with the world.) comments on public writing is a fairly awkward spaaaaaace right now. There are things like AnnotateIt and Awesome Screenshot and the annotations in Diigo. So I’m looking around for other free options and brain storming odd ideas and not find a whole lot and I came up with the following . . . Note: I’m not saying this is a good idea, it may even be a bad idea but it might inspire someone to do something more interesting down the line.1 I at least found it mildly amusing. Here’s how you might pull an author feed from WordPress into Google Spreadsheets with separate cells each paragraph (for paragraph level commenting). The idea being that you can share the Google document with just that student and do the commenting via the GSS commenting feature. Google spreadsheets will import lots of things (xml, atom, rss). WordPress provides lots of specific feeds (author, tag, categories, combinations thereof). So step one is to get the author feed – for example http://rampages.us/fren330/author/sheehantm/feed/. You can then use the IMPORTXML formula in GSS to import that XML and do some XPATH parsing of the pieces. In this case I used =IMPORTXML(“http://rampages.us/fren330/author/sheehantm/”,”//p”) to pull out the paragraphs. I can then share the […]

Little Trick, Big Numbers

I often want to know just a bit more about numbers I see in tables. As I was looking at some thing today, I stumbled on the Wikipedia page for “List of Most Viewed YouTube Videos“. After being more than a bit amazed at the utterly staggering numbers. I wanted to know what they translated to in terms of years because the numbers were just too big. I remembered that Google Spreadsheets will let you pull in a table from a website with no fuss. All I needed to do was put =IMPORTHTML(“http://en.wikipedia.org/wiki/List_of_most_viewed_YouTube_videos”,”table”,1) in the first cell on the spreadsheet and viola the table is transcluded. I can now add a few more calculations to figure out the import stuff – like how many years worth of time have been spent watching Gangnam Style (16,274.24 years for the record1). You can go mess around with the data here. 1 Assuming I didn’t screw something up.