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; }

In reply to Read Excel file via Perl by AE1602

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.