Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

"...I found it gave a lot of warnings for empty cells and it did not even handle the utf-8 euro symbol at all"

Emphasis mine. From rt://40061:

'The Euro symbol isn't stored in Excel as a single character. It is stored as a UTF-16 character and is returned by Spreadsheet::ParseExcel as a Perl utf8 character.'

'This is what you are seeing and in terms of the way Spreadsheet::ParseExcel handles Unicode it is the correct behaviour.'

'How you should handle the utf8 string from there depends on what you want to do with it.'

further on..

"I've come to the conclusion the there is no great solution for parsing Excel files with Perl. That makes me sad. "

If you are saddened by what is available, extend what's there or write your own. Alternatively Spreadsheet::Read:

#!/usr/bin/perl use strict; use warnings; use feature 'say'; use Spreadsheet::Read; use open ':std', ':encoding(UTF-8)'; my $book = ReadData('euro.xlsx'); my $cell = $book->[1]{A1}; say $cell;

Output:

€40

In reply to Re^3: Looking for assistance for proper fix for Spreadsheet::XLSX bug(?) by marto
in thread Looking for assistance for proper fix for Spreadsheet::XLSX bug(?) by nysus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-25 23:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found