https://github.com/ekylibre/spreet
Universal handler for spr[eadsh]eets
https://github.com/ekylibre/spreet
Last synced: 2 months ago
JSON representation
Universal handler for spr[eadsh]eets
- Host: GitHub
- URL: https://github.com/ekylibre/spreet
- Owner: ekylibre
- License: mit
- Created: 2011-10-27T13:42:20.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2015-02-02T18:39:36.000Z (over 10 years ago)
- Last Synced: 2024-09-19T20:47:52.334Z (8 months ago)
- Language: Ruby
- Homepage:
- Size: 211 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
- License: MIT-LICENSE
Awesome Lists containing this project
README
= Spreet
{}[http://badge.fury.io/rb/spreet]
{}[http://travis-ci.org/ekylibre/spreet]
Universal handler for spr[eadsh]eets.
Compatible with Ruby ≥ 1.9.2.
== Why ?
This gems is a handler for spreadsheets. With its independent API, it is possible to create, update files in some formats. Today the list is not very long:* CSV: UTF-8 with commas (Read & Write)
* CSV for Excel: CP1252 with semicolons (Read & Write)
* ODS: Open Document Format (Read & Write with restrictions)== Installation
gem install spreet
== How to use it
# Create a new document
doc = Spreet::Document.new
sheet = doc.sheets.add "My Sheet"# Coordinates can be called with spreadsheet style...
sheet["A1"] = "Last name"
# ...or more classic style...
sheet[1,0] = "First name"
# ...or if necessary as a Hash
sheet[x: 2, y: 0] = "Born on"sheet.next_row
for person in People.all
sheet.row person.last_name, person.first_name, person.born_on
end# Write it as a classic CSV
sheet.write("people-1.csv")
# Write it as a CSV for Excel
sheet.write("people-2.csv", :format=>:xcsv) # CSV for Excel
# or write it as an Open Document Spreadsheet
sheet.write("people-3.ods")# Read an existing document
doc = Spreet::Document.read("doc.ods")
== To do* Add style management for cells
* Add Header/Footer
* HTML Writer
* PDF Writer like LibreOffice would make it