 |
Forums |
Admin Discussion Forums: help Start New Thread
By: W N
Updating Excel file [ reply ] 2010-02-02 19:32
|
I am trying to change an existing Excel file.
First by opening the Excel file and determining the number of rows by reading the file. Then
I want to insert some new data into the same
file. The file GUIDE.TXT says, its not advisable
to do so. Is there another way of changing
an existing Excel file ??
require 'spreadsheet'
# open test.xls
book = Spreadsheet.open 'test.xls'
sheet = book.worksheet 0
rowcount = 0
sheet.each do |row|
rowcount += 1
end
# now insert new data
(0..10).each do |i|
sheet.row(i).push "Testing"
sheet.row(i).push "Excel"
end
book.write "test.xls" # <<<<< Error
|
|
 |