AE1602 has asked for the wisdom of the Perl Monks concerning the following question:
I have the the following code with code which work in window 10 but isn't work in Linux.
Error I get is as following:
Attempt to reload Spreadsheet/ParseXLSX.pm aborted.
Compilation failed in require at ./CreInventoryFromExcel.pl line 35.
BEGIN failed--compilation aborted at ./CreInventoryFromExcel.pl line 35.
I have the following modules under the PWD:
ls -R lib/Spreadsheet/
lib/Spreadsheet/:
ParseExcel ParseExcel.pm ParseXLSX ParseXLSX.pm Read.pm
lib/Spreadsheet/ParseExcel:
Cell.pm Dump.pm FmtDefault.pm FmtJapan2.pm FmtJapan.pm FmtUnicode.pm Font.pm Format.pm SaveParser SaveParser.pm Utility.pm Workbook.pm Worksheet.pm
lib/Spreadsheet/ParseExcel/SaveParser:
Workbook.pm Worksheet.pm
lib/Spreadsheet/ParseXLSX:
Decryptor Decryptor.pm
lib/Spreadsheet/ParseXLSX/Decryptor:
Agile.pm Standard.pm
uname -a
Linux eaasrt 3.10.0-514.el7.x86_64 #1 SMP Wed Oct 19 11:24:13 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux
#!/usr/bin/perl -w BEGIN { push(@INC, $ENV{'PWD'}."/lib"); push(@INC, $ENV{'PWD'}."/lib/Spreadsheet"); } use strict; use warnings; use Getopt::Std; use Time::Local; use File::Basename; use Switch; use Data::Dumper qw(Dumper); ... $i_excelSheetName = $optionsHash{'s'} ; ... my $book = ReadData ($i_excelFileName); my @lines ; my $inLineTmp; my $sheetID = $book->[0]{'sheet'}{$i_excelSheetName}; if (! defined $sheetID) { print "\n\nError: Not found sheen name ".$i_excelSheetName." in In +put Excel file.\n"; print "Available Sheets in Excel are: \n"; print Dumper \$book->[0]{'sheet'}; die "Program stopped.\n\n"; } my @rows = Spreadsheet::Read::rows($book->[$sheetID]); # Go over all lines. 'scalar' return the total number of lines. Since +we should start from line 0, loop initial to 1 and we used i-1 foreach my $i (1 .. scalar @rows) { $inLineTmp = $rows[$i-1][0]; foreach my $j (1 .. scalar @{$rows[$i-1]} -1 ) { if (defined ($rows[$i-1][$j] )) { $inLineTmp .= ",".$rows[$i-1][$j]; } else { $inLineTmp .= ","; } } push @lines , $inLineTmp; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Read Excel file via Perl
by alexander_lunev (Pilgrim) on Sep 17, 2018 at 17:50 UTC | |
|
Re: Read Excel file via Perl
by thanos1983 (Parson) on Sep 17, 2018 at 17:40 UTC | |
by alexander_lunev (Pilgrim) on Sep 17, 2018 at 18:00 UTC | |
by thanos1983 (Parson) on Sep 17, 2018 at 18:28 UTC | |
|
Re: Read Excel file via Perl
by poj (Abbot) on Sep 17, 2018 at 17:53 UTC |