From: Rochit Sen Date: 2012-11-11T19:35:01+09:00 Subject: Issue in reading the contents of XLSX using roo gem Hi All, I have to parse through and store the contents of each cell in an array. I wrote the following. But when i print the contents of my resultant array "contents" all i get is [nil,nil,nil....nil]. Please correct where i am wrong? In the following code i am first getting what is the max number of rows and cols i have in the xlsx file. Then run through the cells using the lastRow and lastColumn in the for loop. ----------------------- require 'roo' require 'rubygems' #Excel file instance workbook = Excelx.new(ARGV[0]) #Need to find the count of lastrow and last column lastRow = workbook.last_row lastColumn = workbook.last_column print "Last row -"+" ", lastRow print "Last column -"+" ",lastColumn #parse the first sheet contents contents = [] for i in 1..lastRow do for j in 1..lastColumn do contents.push(workbook.cell([i],[j],workbook.sheets[0])) j=j+1 end i=i+1 end print contents ------------------------- thanks -- Posted via http://www.ruby-forum.com/.