Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Ruby gem: Simple spreadsheet is a reader for common formats: Excel (.xls, .xlsx), Open-office (.ods) and some CSV (standard, excel, tab separated)
Branch: master

Merge pull request #10 from leifg/fix_csv_handling

adjust csv handling to new roo interface
latest commit c6a7aed9e3
@zenkay authored

Simple Spreadsheet Build Status

Recently I wrote a module to import raw data from Excel-like files to database and export it in various formats. To accomplish this i have to use different gems with different usage patterns so I decide to wrap them in a single simple gem. This is a spreadsheet reader and writer that (will) supports common formats: CSV (.csv), Excel (.xls, .xlsx), Open-office (.ods) and Google (online).

Used gems:


Add to your Gemfile and run the bundle command to install it.

 gem "simple-spreadsheet"

N.B. Tested only with Ruby 1.9.2.

Basic functionality

Reading Spreadsheet


require "simple-spreadsheet"

s ="my_spreadsheets_file.xls")

Supported formats:

Excel (.xls) Excelx (.xlsx) Openoffice (.ods) CSV (.csv) CSV Excel CSV Tab Separated
Reading whole file Yes Yes Yes Yes Yes Yes
Reading line by line Yes - - Yes Yes Yes


Get all data from some cols of first sheet of a XLS file

require "simple-spreadsheet"

s ="my_spreadsheets_file.xls")
s.selected_sheet = s.sheets.first
s.first_row.upto(s.last_row) do |line|
  data1 = s.cell(line, 1)
  data2 = s.cell(line, 3)

Get all data from some cols of first sheet of a XLS file (option 2)

require "simple-spreadsheet"

s ="my_spreadsheets_file.xls")
s.first_row.upto(s.last_row) do |line|
  data1 = s.cell(line, 1, 1)
  data2 = s.cell(line, 3, 1)

Accessing CSV Excel (semicolon separated)

require "simple-spreadsheet"

s ="my_spreadsheets_file.csv", ".csvx")

Accessing CSV Tab separated

require "simple-spreadsheet"

# specify format
s ="my_spreadsheets_file.csv", ".csvt")
# use .tsv
s ="my_spreadsheets_file.tsv")

Future plans

  • Reading support for all formats
  • More efficient reading for big spreadsheets (adding sequential reading to Roo standard methods)
  • Writing support for all formats
  • More reading functionalities
  • Edit support for all formats
Something went wrong with that request. Please try again.