Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A utility for spreadsheet-style handling of arrays (e.g. filtering, formatting, and sorting)

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 doc
Octocat-spinner-32 documentation
Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION.yml
Octocat-spinner-32 index.html
Octocat-spinner-32 table_fu.gemspec
README
# TableFu

TableFu turns a matric array(from a csv file for example) into a spreadsheet.

Allows formatting, macros, sorting, and faceting.

Documentation:
http://propublica.github.com/table-fu

Installation:
gem install table-fu


## Usage

    csv =<<-CSV
    Project,Cost,Date,URL
    Build Supercollider,500_000_000.50,09/15/2009,http://project.com
    Harness Power of Fusion,25_000_000,09/16/2009,http://project2.com
    Motorized Bar Stool,45.00,09/17/2009,http://project3.com
    CSV
    
    @spreadsheet = TableFu.new(csv) do |s|
      s.formatting = {'Cost' => 'currency',
                      'Link' => {'method'=> 'link', 'arguments' => ['Project', 'URL']}}
      s.sorted_by = {'Project' => {'order' => 'descending'}}
      s.columns = ['Date', 'Project', 'Cost', 'Link']
    end 

    @spreadsheet.rows[0].column_for('Cost').to_s #=> '$45.00'
    
    @spreadsheet.rows[0].columns[1].to_s #=> 'Motorized Bar Stool'
    
    @spreadsheet.rows[0].column_for('Link').to_s 
    #=> "<a href='http://project.com' title='Build Supercollider'>Build Supercollider</a>"
Something went wrong with that request. Please try again.