Methods

Spreadsheet

Synopsis

The Spreadsheet Library is designed to read and write Spreadsheet Documents. As of version 0.6.0, only Microsoft Excel compatible spreadsheets are supported.

Example

require 'spreadsheet'

book = Spreadsheet.open '/path/to/an/excel-file.xls'
sheet = book.worksheet 0
sheet.each do |row| puts row[0] end

Spreadsheet::Encoding – spreadheet – 07.09.2011 – mhatakeyama@ywesee.com Spreadsheet::Encoding – spreadheet – 03.07.2009 – hwyss@ywesee.com


Spreadsheet::Excel Compatibility Layer. Drop-in replacement for Spreadsheet::Excel version <= 0.3.5.1


Future directions may include:

- support for mapping RGB values to "best fit" palette values

by Dan Caugherty github.com/dancaugherty/spreadsheet/compare/master…rgb

Constants

VERSION

The version of Spreadsheet you are using.

Attributes

client_encoding[RW]

Public Class Methods

open(io_or_path, mode="rb+") click to toggle source

Parses a Spreadsheet Document and returns a Workbook object. At present, only Excel-Documents can be read.

# File lib/spreadsheet.rb, line 61
def open io_or_path, mode="rb+"
  if io_or_path.respond_to? :seek
    Excel::Workbook.open(io_or_path)
  elsif block_given?
    File.open(io_or_path, mode) do |fh|
      yield open(fh)
    end
  else
    open File.open(io_or_path, mode)
  end
end
writer(io_or_path, type=Excel) click to toggle source

Returns a Writer object for the specified path. At present, only the Excel-Writer is available.

# File lib/spreadsheet.rb, line 76
def writer io_or_path, type=Excel
  Excel::Writer::Workbook.new io_or_path
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.