How To: Use Google Spreadsheets as a Data Source in WordPress (Part 1)

This is the first in a two post series that will walk you through how to insert content from Google Spreadsheets Inline into WordPress pages.

Background

Recently, I was converting a site from ASP to WordPress. This site details a mortgage loan and its amortization schedule. The amortization schedule is built with Google Spreadsheets. I found it much easier to work with the amortization data in Google Spreadsheets as opposed to storing it in a MySQL database, as I have no experience working with Databases and can do a lot more with Spreadsheets.

As such, I needed a way to pull data from the Google Spreadsheet and display it as needed in a given web page. In the ASP version of the site, I used a script from Bytescout, which pulled data through the RSS feed of spreadsheet. This worked really well and I hoped to replicate it in WordPress.

I looked for a similar solution in the form of a wordpress plugin. I tried:

inlineRSS – I ran into issues getting feed data without a barrage of errors.

Inline Google Docs – I got this to work successfully, but it did more than I was looking for. It showed the entire sheet without any options to only pull in specific cells.

inlineFeed – I know I tried this, but it didn’t work, though I can’t remember more than that.

Ultimately, none of those worked, and I was thinking I would have to start learning MySQL and become a database expert. Then I found SimplePie. Keep reading for how to integrate your Google Spreadsheet data into WordPress pages.

Step 1 – Create your spreadsheet in Google Spreadsheets

For this example, I’ll be using this spreadsheet. You can use any Google Spreadsheet you’d like. You will need to isolate the data you are looking to return in it’s own cell. By this I mean that if you want to do some data manipulation of any of your data, store the result in its own cell. Your spreadsheet will handle the calculation, RSS will deliver the result.

Step 2 – Determine the RSS Feed for your spreadsheet.

After you have your sheet created to your liking, we have to figure out the feed for that spreadsheet.

About this Plugin

This plugin does absolutely nothing except load the core SimplePie library so that all other plugins that utilize SimplePie can all share the same up-to-date version. It also helps minimize potential conflicts between SimplePie-powered plugins.