The RGraph Google Sheets connector has been upgraded

Written by Richard, on 13th May 2019

Google Sheets logo

Previously the Google Sheets[icon] connector supported fetching rows, columns and cells by using the get method. This method has now been updated to also support the fetching of a matrix of cells.

So whereas previously you could fetch individual rows, columns and cells - you can now fetch multiple rows of information in a single operation. For example:

var matrix = sheet.get('A2:E13');

You can see this in action by viewing the example chart on the Google Sheets documentation page.

Also, recently new is the PHP version of the Google Sheets connector. So now there are versions available for the canvas and svg libraries - and now one for PHP too.

You may ask why a PHP version is relevant - there are a couple of reasons that come to mind immediately:

  • You don't want to embed the id of your Google Sheet into the page.
    Maybe you don't want to share this information - despite the spreadsheet not being publicly available.
  • You need to incorporate the data into your back-end code.
    Perhaps you need to use the data from your spreadsheet in your PHP or other server-based code.

If you don't use PHP then it shouldn't be too difficult for you to take this code and convert it into whatever language that you do use - PHP isn't exactly difficult to read and understand!

So now that's three libraries for Google Sheets - two of which are essentially the same and another for when you're looking to access your spreadsheet from PHP.

If you don't already use Google Sheets then it's well worth a look. It's essentially a web-based Excel.

It doesn't have all of the features of Excel but if your usage isn't too intense then it could save you a lot of money (since Google Sheets is basically free).

Availability

The PHP version of the tool is available immediately - and you can download the source code here. The canvas and svg JavaScript versions will however be available with the next version of RGraph when it's released (version 5.01).