No release in over 3 years
Low commit activity in last 3 years
Simple spreadsheet reader for common formats: Excel (.xls, .xlsx), Open-office (.ods) and some CSV (standard, excel, tab separated). Future versions: writing and more formats.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
~> 10.1
~> 3.3

Runtime

~> 2.4
~> 1.0
 Project Readme

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).

Installation

Add this line to your application's Gemfile:

gem 'simple-spreadsheet'

And then execute:

$ bundle install

Functionalities

Reading Spreadsheet

Example:

require "simple-spreadsheet"

s = SimpleSpreadsheet::Workbook.read("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

Recipes

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

require "simple-spreadsheet"

s = SimpleSpreadsheet::Workbook.read("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)
end

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

require "simple-spreadsheet"

s = SimpleSpreadsheet::Workbook.read("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)
end

Accessing CSV Excel (semicolon separated)

require "simple-spreadsheet"

s = SimpleSpreadsheet::Workbook.read("my_spreadsheets_file.csv", ".csvx")

Accessing CSV Tab separated

require "simple-spreadsheet"

# specify format
s = SimpleSpreadsheet::Workbook.read("my_spreadsheets_file.csv", ".csvt")
# use .tsv
s = SimpleSpreadsheet::Workbook.read("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

Credits