in reply to Re^4: protect excel file in perl script
in thread protect excel file in perl script

If you download the module Spreadsheet::ParseXLSX and look in the tests folder, 't', you'll find a file called encryption.t which has example code for opening password protected spreadsheets.

Replies are listed 'Best First'.
Re^6: protect excel file in perl script
by arunks (Novice) on Jan 23, 2017 at 10:42 UTC
    ok I will try this. But before opening an excel file prompt should come and ask for password to open the excel file.am looking for password protection only not encryption the file.am seeing some cell value ..why is that. Please confirm. my $cell = $worksheet->get_cell(1, 1); is($cell->value, 'abcdefgABCDEFG');
        getting this below error:
        Can't locate object method "parse" via package "Spreadsheet::ParseExce +l" at pfiz_files2xl_merger.pl line 17.
        My code:
        #!/usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; use Spreadsheet::ParseExcel; { my $filename = '/app/etl/Informatica/dev/PowerCenter/9.5/server/** +**3212.xls'; my @inputs = ( $filename, do { open my $fh, '<:raw:bytes', $filename or die; $fh }, do { open my $fh, '<:raw:bytes', $filename or die; local $/; m +y $d = <$fh>; \$d }, ); my $parser = Spreadsheet::ParseExcel->new(Password => '123q'); for my $input (@inputs) { my $workbook = $parser->parse($input); my $worksheet = $workbook->worksheet(0); my $cell = $worksheet->get_cell(1, 1); is($cell->value, 'abcdefgABCDEFG'); }
        below packages only installed in server
        -bash-3.2$ yum list all |grep perl *Note* Red Hat Network repositories are not listed below. You must run + this command as root to access RHN repositories. mod_perl.x86_64 2.0.4-6.el5 + installed newt-perl.x86_64 1.08-9.2.2 + installed perl.x86_64 4:5.8.8-43.el5_11 + installed perl-MIME-Lite.noarch 3.01-5.el5 + installed perl-MailTools.noarch 1.77-1.el5 + installed perl-OLE-Storage_Lite.noarch 0.19-1.el5 + installed perl-Spreadsheet-ParseExcel.x86_64 0.3200-3.el5 + installed perl-Spreadsheet-WriteExcel.noarch 2.37-1.el5.rf + installed perl-XML-Parser.x86_64 2.34-6.1.2.2.1 + installed perl-libwww-perl.noarch 5.805-1.1.1 + installed