Method: Spreadsheet::Workbook#create_worksheet

Defined in:
lib/spreadsheet/workbook.rb

#create_worksheet(opts = {}) ⇒ Object

Create a new Worksheet in this Workbook. Used without options this creates a Worksheet with the name ‘WorksheetN’ where the new Worksheet is the Nth Worksheet in this Workbook.

Use the option :name => ‘My pretty Name’ to override this behavior.



54
55
56
57
# File 'lib/spreadsheet/workbook.rb', line 54

def create_worksheet opts = {}
  opts[:name] ||= client("Worksheet#{@worksheets.size.next}", 'UTF-8')
  add_worksheet Worksheet.new(opts)
end