in reply to Re^3: Read excel column and compare with array
in thread Read excel column and compare with array

Hi thanos1983, I am sorry for your name. I have tired this ...
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use Spreadsheet::Read; use Spreadsheet::XLSX; use Text::Iconv; my $converter = Text::Iconv -> new ("utf-8", "windows-1251"); my $excel = Spreadsheet::XLSX -> new ('C:/SLB/Dashboard/DCSS_Applicati +ons.xlsx', $converter); my @DCSS_ss; foreach my $sheet (@{$excel -> {Worksheet}}) { printf("Sheet: %s\n", $sheet->{Name}); $sheet -> {MaxRow} ||= $sheet -> {MinRow}; foreach my $row ($sheet -> {MinRow} .. $sheet -> {MaxRow}) { $sheet -> {MaxCol} ||= $sheet -> {MinCol}; my $cell = $sheet -> {Cells} [$row] [2]; s/^\s+|\s+$//g for $cell->{Val}; if ($cell) { push @DCSS_ss, { SSRID =>$cell -> {Val} }; } } } print Dumper \@DCSS_ss;
TY

Replies are listed 'Best First'.
Re^5: Read excel column and compare with array
by thanos1983 (Parson) on Jul 17, 2017 at 10:47 UTC

    Hello snehit.ar,

    Are you getting an error? Is it not working? What is the problem? (I have not run your updated code).

    Update: I just found that you are copying pasting the example given from the module Spreadsheet::XLSX. You can not mix modules and expect them to work. The methods do not apply on both modes. Decide which module you want to use and create your solution.

    Hint: read again module Spreadsheet::Read/sheets and find the line my $sheets = $book->sheets; I think this is what you are looking for.

    BR, Thanos1983.

    Seeking for Perl wisdom...on the process of learning...not there...yet!
      Yes @Thanos1983 -You are wight i am using same code ... As u suggested i will explore on "Spreadsheet::Read/sheets"...

        Hello again snehit.ar,

        Did you manage to figure it out?

        Let us know if you got stuck somewhere. It should be easy from here you have all the data.

        Seeking for Perl wisdom...on the process of learning...not there...yet!