No commit activity in last 3 years
No release in over 3 years
WrapExcel is to wrap the win32ole, and easy to use Excel operations with ruby. Detailed description please see the README.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 2.1.1
>= 0.9.2
>= 0.0.5
>= 2.6.0
>= 0.0.3
>= 1.3.2
 Project Readme

WrapExcel¶ ↑

Description¶ ↑

WrapExcel is a to wrap the win32ole, and easy to use Excel operations with ruby.

Requirements¶ ↑

  • ruby 1.9.2 or higher (platform is windows)

Install¶ ↑

gem install wrap_excel

Usage¶ ↑

access book¶ ↑

Read with block.

WrapExcel::Book.open('./sample.xls') do |book|
  # do something
end

Read without block.

book = WrapExcel::Book.open('./sample.xls')
book.close

Options are the following.

read_only

boolean(default true)

displayalerts

boolean(default false)

visible

boolean(default false)

access sheet¶ ↑

Sheet object can access with Book#[] method.

sheet = book[0]

Access with sheet name.

book['Sheet1']

access row or column¶ ↑

Sheet object is included enumerable. Use Sheet#each_column or Sheet#each_row or Sheet#each method.

sheet.each do |cell|
  # do something with cell
  # read every row every column
end

sheet.each_row do |row|
  # do something with row_range
end

sheet.each_column do |column_range|
  # do something with column_range
end

access cell¶ ↑

Read from sheet object.

sheet[0, 0]  => first cell.

Read from range object

row_range[0]  => first cell in row_range
column_range[1] => second cell in column_range

write excel¶ ↑

Can save an existing file.

WrapExcel::Book.open('./sample.xls', :read_only => false) do |book|
  # do something
  book.save
end

or

book = WrapExcel::Book.open('./sample.xls', :read_only => false)
book.save
book.close

Can save an another file name.

WrapExcel::Book.open('./sample.xls', :read_only => false) do |book|
  # do something
  book.save './another_file.xls'
end

Save to another_file.xls

Can not save new file.

Want to do more things¶ ↑

All WrapExcel object include win32ole instance. If you want to do something that not provide a function, you can use win32ole methods.

Support¶ ↑

Report issues and feature requests to github Issues. github.com/tomiacannondale/wrap_excel/issues

Collaborate¶ ↑

Please pull request on github.

Author¶ ↑

tomi tomiacannondale@gmail.com

License¶ ↑

MIT License. For more imformation, please see LICENSE.