I want to read an XLSX file on Windows 10 which is saved in a folder with not Latin characters. Even if I tried different ways and modules, it fails. In my example the folder+filename contains Russian characters. With Latin alphabets everything works fine. The problems seems related to the module Zip::Archive. Any suggestions?
use Spreadsheet::XLSX;
use Win32::LongPath;
use Win32;
use utf8;
my $path="Ршзефф\\faoü.xlsx";
#my $path="Ршзефф.xlsx";
#my $path="faoü.xlsx";
#my $MYPath = Win32::GetANSIPathName ($path);
my $MYPath = shortpathL ($path);
print "$MYPath \n\n";
my $excel = Spreadsheet::XLSX -> new ($MYPath);
my $counter=0;
foreach my $sheet (@{$excel -> {Worksheet}}) {
if ($counter eq 0){#work only on first sheet now
$sheet -> {MaxRow} ||= $sheet -> {MinRow};
foreach my $row ($sheet -> {MinRow} .. $sheet
+-> {MaxRow}) {
$sheet -> {MaxCol} ||= $sheet -> {MinCol};
+
foreach my $col ($sheet -> {MinCol} .. $s
+heet -> {MaxCol}) {
my $cell = $sheet -> {Cells} [$row] [$
+col];
if ($cell) {
my $cell_value = ($cell -> {Va
+l});
$cell_value =~ s/\n//g;
print $cell_value;
}
print "\t";
}
print "\n";
}
$counter=1;
}
}
-
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.
|