normskib has asked for the wisdom of the Perl Monks concerning the following question:

Greetings Wise Monks

I have an Excel spreadsheet that has been uploaded to a MySQL database and stored as binary data in a BLOB field using UTF-8 encoding. I'm passing a scalar reference to the binary data to the Workbook->Parse() method of Spreadsheet::ParseExcel but it always returns undef. I know the spreadsheet data is OK because I can use the same scalar reference, together with suitable HTTP headers to export the data to Excel via a web browser.

Do I need to read the binary data into a temporary file first with a suitable encoding option and then pass this file to the Parse() method? Or is there another problem here?

Any thoughts and/or advice welcomed.

Cheers

Norman Buskell

  • Comment on Problems using Spreadsheet::ParseExcel with mySQL binary data

Replies are listed 'Best First'.
Re: Problems using Spreadsheet::ParseExcel with mySQL binary data
by moritz (Cardinal) on Jan 06, 2009 at 13:00 UTC
    and stored as binary data in a BLOB field using UTF-8 encoding.

    UTF-8 encoding is for text data. Binary data doesn't need an extra encoding.

    Do I need to read the binary data into a temporary file first with a suitable encoding option and then pass this file to the Parse() method?

    No, all encoding steps that an IO layer might perform can also be done without writing to a file (for example with Encode). But you shouldn't need this, because you should never treat binary data as text, and never encode or decoded it with utf-8.