Class: Spreadsheet::Worksheet

Inherits:
Object
  • Object
show all
Includes:
DataShift::ExcelBase
Defined in:
lib/applications/spreadsheet_extensions.rb

Instance Attribute Summary

Attributes included from DataShift::ExcelBase

#excel, #sheet

Instance Method Summary collapse

Methods included from DataShift::ExcelBase

#ar_to_xls, #ar_to_xls_cell, #ar_to_xls_row, max_columns, #open_excel, #parse_headers, #sanitize_sheet_name, #start_excel

Instance Method Details

#num_rowsObject



28
29
30
# File 'lib/applications/spreadsheet_extensions.rb', line 28

def num_rows
  rows.size
end

#set_headers(headers, _apply_style = nil) ⇒ Object

Convert array into a header row



20
21
22
23
24
25
26
# File 'lib/applications/spreadsheet_extensions.rb', line 20

def set_headers(headers, _apply_style = nil)
  return if headers.empty?

  headers.each_with_index do |header, i|
    self[0, i] = header.to_s
  end
end