D
Dave Burns
Maybe I need to close the file or something?
This invokation runs fine, but generates *so* much output:
ruby -rubygems excelparse.rb stuff.xls
so I piped it to head and it bombs:
ruby -rubygems excelparse.rb stuff.xls|head
Row: 0 Cell: 0> Dispapp
Row: 0 Cell: 1> Iprc
Row: 0 Cell: 2> UH tag
Row: 0 Cell: 3> Weight
Row: 0 Cell: 4> Tags removed
Row: 0 Cell: 5> Disk removed or wiped
Row: 1 Cell: 0> 80118
Row: 1 Cell: 1> 1173
Row: 1 Cell: 2> 961SU
Row: 2 Cell: 0> 80118
excelparse.rb:19:in `write': Broken pipe (Errno::EPIPE)
from excelparse.rb:19:in `puts'
from excelparse.rb:19
from excelparse.rb:15:in `each'
from excelparse.rb:15
from /usr/lib/ruby/gems/1.8/gems/parseexcel-0.5.2/lib/parseexcel/worksheet.rb:143:in
`each'
from /usr/lib/ruby/gems/1.8/gems/parseexcel-0.5.2/lib/parseexcel/worksheet.rb:143:in
`each'
from excelparse.rb:11
Any hints? The script itself is a minor mod of the example given at
the parseexcel site (see below).
Mahalo,
Dave
cat excelparse.rb
require 'parseexcel'
#Open the excel file passed in from the commandline
workbook = Spreadsheet:arseExcel.parse(ARGV[0])
#Get the first worksheet
worksheet = workbook.worksheet(0)
j=0
#cycle over every row
worksheet.each { |row|
i=0
if row != nil
#cycle over each cell in this row if it's not an empty row
row.each { |cell|
if cell != nil
#Get the contents of the cell as a string
contents = cell.to_s('latin1')
puts "Row: #{j} Cell: #{i}> #{contents}"
end
i = i+1
}
end
j=j+1
}
This invokation runs fine, but generates *so* much output:
ruby -rubygems excelparse.rb stuff.xls
so I piped it to head and it bombs:
ruby -rubygems excelparse.rb stuff.xls|head
Row: 0 Cell: 0> Dispapp
Row: 0 Cell: 1> Iprc
Row: 0 Cell: 2> UH tag
Row: 0 Cell: 3> Weight
Row: 0 Cell: 4> Tags removed
Row: 0 Cell: 5> Disk removed or wiped
Row: 1 Cell: 0> 80118
Row: 1 Cell: 1> 1173
Row: 1 Cell: 2> 961SU
Row: 2 Cell: 0> 80118
excelparse.rb:19:in `write': Broken pipe (Errno::EPIPE)
from excelparse.rb:19:in `puts'
from excelparse.rb:19
from excelparse.rb:15:in `each'
from excelparse.rb:15
from /usr/lib/ruby/gems/1.8/gems/parseexcel-0.5.2/lib/parseexcel/worksheet.rb:143:in
`each'
from /usr/lib/ruby/gems/1.8/gems/parseexcel-0.5.2/lib/parseexcel/worksheet.rb:143:in
`each'
from excelparse.rb:11
Any hints? The script itself is a minor mod of the example given at
the parseexcel site (see below).
Mahalo,
Dave
cat excelparse.rb
require 'parseexcel'
#Open the excel file passed in from the commandline
workbook = Spreadsheet:arseExcel.parse(ARGV[0])
#Get the first worksheet
worksheet = workbook.worksheet(0)
j=0
#cycle over every row
worksheet.each { |row|
i=0
if row != nil
#cycle over each cell in this row if it's not an empty row
row.each { |cell|
if cell != nil
#Get the contents of the cell as a string
contents = cell.to_s('latin1')
puts "Row: #{j} Cell: #{i}> #{contents}"
end
i = i+1
}
end
j=j+1
}