Method: Axlsx.cell_range

Defined in:
lib/axlsx.rb

.cell_range(cells, absolute = true) ⇒ Object

determines the cell range for the items provided



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/axlsx.rb', line 51

def self.cell_range(cells, absolute=true)
  return "" unless cells.first.is_a? Cell
  cells = sort_cells(cells)
  reference = "#{cells.first.reference(absolute)}:#{cells.last.reference(absolute)}"
  if absolute
    escaped_name = cells.first.row.worksheet.name.gsub "'", "''"
    "'#{escaped_name}'!#{reference}"
  else
    reference
  end
end