Created
January 25, 2013 18:38
-
-
Save BiggerNoise/4636781 to your computer and use it in GitHub Desktop.
Shows using the spreadsheet gem to read a file that is flawed. Worksheets and dimensions are correct, but cell data cannot be read. File that causes the issue can be found at: http://dl.dropbox.com/u/83477489/sample.xls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
wb = Spreadsheet.open('sample.xls') | |
puts "Opened Spreadsheet, #{wb.sheet_count} sheets encountered" | |
(0..wb.sheet_count-1).each do |sheet_number| | |
ws = wb.worksheet(sheet_number) | |
puts "\tWorksheet #{ws.name} has #{ws.row_count} rows and #{ws.column_count} columns}; and Dimensions: #{ws.dimensions}" | |
end | |
puts "Opened Spreadsheet, #{wb.sheet_count} sheets encountered" | |
ws = wb.worksheet(0) | |
puts "\tWorksheet '#{ws.name}' has #{ws.row_count} rows and #{ws.column_count} columns}; and Dimensions: #{ws.dimensions}" | |
row_index = 5 | |
row = ws.row row_index | |
puts "\tWorksheet '#{ws.name}' row #{row_index}: #{row.to_s}" | |
puts "\tWorksheet '#{ws.name}' cell(#{row_index}, 0): #{ws.cell(row_index, 0)}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, that's the same thing that I have been getting. You can read the sheets and their titles, but you cannot see any of the data.
So, no, this is still not working for me.