我正在尝试使用 Ruby 读取 Excel 电子表格文件,但它没有读取文件的内容。
这是我的脚本
book = Spreadsheet.open 'myexcel.xls';
sheet1 = book.worksheet 0
sheet1.each do |row|
puts row.inspect ;
puts row.format 2;
puts row[1];
exit;
end
它给了我以下信息:
[DEPRECATED] By requiring 'parseexcel', 'parseexcel/parseexcel' and/or
'parseexcel/parser' you are loading a Compatibility layer which
provides a drop-in replacement for the ParseExcel library. This
code makes the reading of Spreadsheet documents less efficient and
will be removed in Spreadsheet version 1.0.0
#<Spreadsheet::Excel::Row:0xffffffdbc3e0d2 @worksheet=#<Spreadsheet::Excel::Worksheet:0xb79b8fe0> @outline_level=0 @idx=0 @hidden=false @height= @default_format= @formats= []>
#<Spreadsheet::Format:0xb79bc8ac>
nil
我需要获取文件的实际内容。我究竟做错了什么?