无法使用rubyXL从xlsx文件中读取

时间:2023-02-06 12:49:12

I'm trying to work with excel files(xlsx) in ruby using rubyXl. I have no problem writing but can't get to output the content of a cell.

我正在尝试使用rubyXl在ruby中使用excel文件(xlsx)。我没有写问题,但无法输出单元格的内容。

require 'rubyXL'
workbook = RubyXL::Workbook.new
workbook.worksheets[0].add_cell(5,5,"test")
workbook.write("file3.xlsx")
getcell = RubyXL::Parser.parse("file3.xlsx")
print getcell[0][5][5]

When I run it in cmd I just get this and it changes every time I run the code.

当我在cmd中运行它时,我只是得到它,每次运行代码时它都会改变。

D:\KEA\1.semester\Exams\IT exam>ruby test.rb
#<RubyXL::Cell:0x2e4a600>

SOLUTION:

After reading a few more times I found the answer in

经过几次阅读后,我找到了答案

http://rubydoc.info/gems/rubyXL/1.1.12/RubyXL/Cell

It should have been

应该是的

print getcell[0][5][5].value

1 个解决方案

#1


0  

After reading a few more times I found the answer in

经过几次阅读后,我找到了答案

http://rubydoc.info/gems/rubyXL/1.1.12/RubyXL/Cell

It should have been

应该是的

print getcell[0][5][5].value

#1


0  

After reading a few more times I found the answer in

经过几次阅读后,我找到了答案

http://rubydoc.info/gems/rubyXL/1.1.12/RubyXL/Cell

It should have been

应该是的

print getcell[0][5][5].value