Parseexcel retrieve strange chars

L

Luiz

Hi,

I am a Ruby newbie, and I am trying to use parseexcel library to
retrieve some information from a spreadsheet, but when I try this, I
receive the chars contained on the cell alternated square chars. Does
anybody knows how to solve this?

Thanks,

Luiz
 
L

Luiz

I print the square code char and it is zero (nil). Please, somebody
help me.

workbook = Spreadsheet::parseExcel.parse('myspreadsheet.xls')

# usually, you want the first worksheet:
worksheet = workbook.worksheet(0)

# now you can either iterate over all rows, skipping the first
number of
# rows (in case you know they just contain column headers)
myVal = worksheet.cell(0,4).value
puts myVal
 
C

Chris Shea

Luiz said:
I print the square code char and it is zero (nil). Please, somebody
help me.

workbook = Spreadsheet::parseExcel.parse('myspreadsheet.xls')

# usually, you want the first worksheet:
worksheet = workbook.worksheet(0)

# now you can either iterate over all rows, skipping the first
number of
# rows (in case you know they just contain column headers)
myVal = worksheet.cell(0,4).value
puts myVal

If you're sure they're all null characters, you can always use gsub to
get rid of them:

myVal.gsub!(/\000/,'')


Chris Shea
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top