It doesn't want to write the file correctly. The code that I currently
have is:
--
def excel
# Create a new spreadsheet
book = Spreadsheet::Workbook.new
sheet = book.create_worksheet
sheet.name = 'All Member Details'
# Add the header row
sheet.row(0).push Member.column_names
puts Member.column_names
# Add the content
Member.find(:all).each_with_index do |member, index|
sheet.row(index + 1).push member.attributes.values
puts member.attributes.values
end
# close the workbook
# book.close
# Offer up the file for download
downloadpath = 'downloads/members.xls'
book.write downloadpath
send_file downloadpath, :x_sendfile => true
end
--
Any help in getting this going would be greatly appreciated.
Thanks,
Matt Delves