简体   繁体   English

Ruby中的roo gem

[英]roo gem in Ruby

I am using 'roo' gem for reading and writing the excel sheets. 我正在使用'roo'gem来读写Excel工作表。 How can I get the last column of each row in excel sheet using 'roo' gem in Ruby 如何在Ruby中使用“ roo” gem获取Excel工作表中每一行的最后一列

Please give me some suggestion on this... 请给我一些建议...

You can do the following: 您可以执行以下操作:

wb = Roo::Excelx.new 'somepath/somefile.xlsx'

1.upto(wb.last_row) do |row_index|
  last_column = wb.cell(row_index, wb.last_column)
end

http://roo.rubyforge.org/ http://roo.rubyforge.org/

You can use a for with the method last_column as stated on the link above. 您可以将for与上述链接中所述的last_column方法last_column使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM