Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Simple tool for running queries against ActiveRecord and putting them into a Google Spreadsheet.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 LICENSE.md
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 spreadsheet_report.gemspec
README.md

Spreadsheet Report

Spreadsheet Report is a simple tool for dumping SQL data into Google Spreadsheets.

Installation

Spreadsheet Report's gem is being hosted on Gemcutter, so you'll need to be set up with them. Find out more at http://gemcutter.org. Once you're set up with Gemcutter, install Spreadsheet Report by executing:

gem install spreadsheet_report

Usage

Here is a basic usage:

require 'spreadsheet_report'

    SpreadsheetReport.new('username', 'password', 'spreadsheet_key') do |sr|
      sr.worksheet("User Data", <<-EOF, ["date", "count"])
        SELECT DATE(created_at) as date, COUNT(*) as count
        FROM users
        GROUP BY DATE(users.created_at)
      EOF
    end

(An example template is included under lib/spreadsheet_report/templates)

How it works

The Spreadsheet Report initializer takes a Google username and password, and the id of the spreadsheet. The key of a spreadsheet can be found in the key parameter of the url for the spreadsheet.

The worksheet method creates a new worksheet if a worksheet with the given name doesn't already exist, or uses the existing worksheet. If the optional columns parameter is given to the worksheet method, only the columns with the given names are added to the spreadsheet, in the order that they are specified.

Spreadsheet Report assumes that you've got a working connection with ActiveRecord already set up. So, the easiest way to run a report is to create a source file with your report code in it, and then run it with the rails script/runner script.

Something went wrong with that request. Please try again.