Skip to content
Simple spreadsheet is a Ruby Gem reader for common spreadsheet formats: Excel (.xls, .xlsx), Open-office (.ods) and CSV (standard, excel, tab separated)
Branch: master
Clone or download
zenkay Merge pull request #19 from openresearch/master
Expose too excelx_value to get the raw value.
Latest commit f998bc2 Mar 15, 2017

Simple Spreadsheet

Code Climate Travis CI Gem Version Coverage Status

A spreadsheet reader and (in the future) writer that supports common formats: CSV (.csv), Excel (.xls, .xlsx), Open-office (.ods) and Google (online).


Add this line to your application's Gemfile:

gem 'simple-spreadsheet'

And then execute:

$ bundle install


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


You can’t perform that action at this time.