I would like to display the most views pages of my site, using Google Analytics as data source. I know that GA provides some very powerful api’s, but they’re quite complicated. I wonder if there’s a plugin or a wrapper which is already doing the dirty job.
The tag code in the spreadsheet plugin does in fact exactly that: parse data from a spreadsheet. If you install the plugin, you can basically copy and paste the data from the tag and use it in your template (with some modifications, of course).
So you can create a new SpreadsheetReader object like this:
$reader = new SpreadsheetReader('path_to_excel_file');
hmm well it used to be that you curl the file down, which could have been tied into a cron job, but seems they turned that option off.
A quick look at the docs hints you can fairly easily use the api to export and download the Excel file. I have never done this, but if its anything like using the calendar API, you will probably need to add a library to your project and set an Oauth token.
You could try googling around, i bet someone out there has written a perl/python/bash script to grab a file from google drive. If the file is publicly accessable, I can’t see why you cant just curl it, but i’ve seen reports of google restricting it.
A cheeky way might be to something similar to the dropbox sync, but rather install the google drive app on your sever if your able to (you would need a VPS for this). You could then symlink the file into your content folder.
Alternatively, I just ran a little test. If you make the sheet both public and publish it (File > Publish to the web), you can indeed use curl to grab it. Just use the url google sheets gives you when you publish. Note the query string on the end - if you need CSV or other format, tweak the query string.