lib/roo/excel.rb
def read_cells(sheet=nil)
    sheet ||= @default_sheet
    validate_sheet!(sheet)
    return if @cells_read[sheet]

    worksheet = @workbook.worksheet(sheet_no(sheet))
    row_index=1
    worksheet.each(0) do |row|
      (0..row.size).each do |cell_index|
        cell = row.at(cell_index)
        next if cell.nil?  #skip empty cells
        next if cell.class == Spreadsheet::Formula && cell.value.nil? # skip empty formula cells
        value_type, v =
          if date_or_time?(row, cell_index)
            read_cell_date_or_time(row, cell_index)
          else
            read_cell(row, cell_index)
          end
        formula = tr = nil #TODO:???
        col_index = cell_index + 1
        font = row.format(cell_index).font
        font.extend(ExcelFontExtensions)
        set_cell_values(sheet,row_index,col_index,0,v,value_type,formula,tr,font)
      end #row
      row_index += 1
    end # worksheet
    @cells_read[sheet] = true
  end
# read all cells in the selected sheet
read all cells in the selected sheet
read all cells in the selected sheet
def read_cells(sheet=nil)
    sheet ||= @default_sheet
    validate_sheet!(sheet)
    return if @cells_read[sheet]
    worksheet = @workbook.worksheet(sheet_no(sheet))
    row_index=1
    worksheet.each(0) do |row|
      (0..row.size).each do |cell_index|
        cell = row.at(cell_index)
        next if cell.nil?  
        next if cell.class == Spreadsheet::Formula && cell.value.nil? 
        value_type, v =
          if date_or_time?(row, cell_index)
            read_cell_date_or_time(row, cell_index)
          else
            read_cell(row, cell_index)
          end
        formula = tr = nil 
        col_index = cell_index + 1
        font = row.format(cell_index).font
        font.extend(ExcelFontExtensions)
        set_cell_values(sheet,row_index,col_index,0,v,value_type,formula,tr,font)
      end 
      row_index += 1
    end 
    @cells_read[sheet] = true
  end
def read_cells ( sheet = nil ) sheet ||= @default_sheet validate_sheet! ( sheet ) return if @cells_read [ sheet ] worksheet = @workbook . worksheet ( sheet_no ( sheet ) ) row_index = 1 worksheet . each ( 0 ) do | row | ( 0 .. row . size ) . each do | cell_index | cell = row . at ( cell_index ) next if cell . nil? next if cell . class == Spreadsheet :: Formula && cell . value . nil? value_type , v = if date_or_time? ( row , cell_index ) read_cell_date_or_time ( row , cell_index ) else read_cell ( row , cell_index ) end formula = tr = nil col_index = cell_index + 1 font = row . format ( cell_index ) . font font . extend ( ExcelFontExtensions ) set_cell_values ( sheet , row_index , col_index , 0 , v , value_type , formula , tr , font ) end row_index += 1 end @cells_read [ sheet ] = true end
read all cells in the selected sheet
read all cells in the selected sheet
#skip empty cells # skip empty formula cells #TODO:??? #row # worksheet
sheet