I am trying to import some data from Excel XLS spreadsheets.
I have worked only with CSV files before, and know how to skip the first row with them, which is a header.
How to do it with XLS files?
I have this code:
require 'spreadsheet'
ook = Spreadsheet.open("/#{Rails.public_path}/uploads_prices/"+name)
book.worksheets.each do |sheet|
sheet.each do |row|
*****
How do I skip the first entry, which is a header?
From the doc: “(…)you can tell Worksheet how many rows should be omitted at the beginning. The following starts at the 3rd row, regardless of whether or not it or the preceding rows contain any data:”
So for this case the following should work: