Parseexcel retrieve strange chars

Discussion in 'Ruby' started by Luiz, Dec 27, 2006.

  1. Luiz

    Luiz Guest

    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
    Luiz, Dec 27, 2006
    #1
    1. Advertising

  2. Luiz

    Luiz Guest

    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

    Luiz wrote:
    > 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
    Luiz, Dec 27, 2006
    #2
    1. Advertising

  3. Luiz

    Chris Shea Guest

    Luiz wrote:
    > 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
    Chris Shea, Dec 27, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kosio

    Floats to chars and chars to floats

    Kosio, Sep 16, 2005, in forum: C Programming
    Replies:
    44
    Views:
    1,285
    Tim Rentsch
    Sep 23, 2005
  2. Hongyu
    Replies:
    9
    Views:
    902
    James Kanze
    Aug 8, 2008
  3. M.Posseth

    receiving ??? chars instead of "special" chars

    M.Posseth, Nov 15, 2004, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    227
    Dan Rogers
    Nov 16, 2004
  4. Nigel Wilkinson

    problems with parseexcel module

    Nigel Wilkinson, Dec 2, 2003, in forum: Ruby
    Replies:
    0
    Views:
    96
    Nigel Wilkinson
    Dec 2, 2003
  5. Replies:
    2
    Views:
    116
Loading...

Share This Page