Method: RubyExcel::Workbook#add
- Defined in:
- lib/rubyexcel.rb
#add(ref = false) ⇒ RubyExcel::Sheet Also known as: add_sheet
Adds a Sheet to the Workbook.
If no argument is given, names the Sheet 'Sheet' + total number of Sheets
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/rubyexcel.rb', line 91 def add( ref = false ) case ref when false ; s = Sheet.new( 'Sheet' + ( @sheets.count + 1 ).to_s, self ) when Sheet ; ( s = ref ).workbook = self when String ; s = Sheet.new( ref, self ) else ; fail TypeError, "Unsupported Type: #{ ref.class }" end @sheets << s s end |