in reply to Merging worksheets in .xls in one Excel sheet

It maybe that your spreadsheets have cells with spaces in which are overwriting earlier spreadsheets. Run this to check

#!/usr/bin/perl use strict; use Spreadsheet::ParseXLSX; my $target = 'Target.xlsx'; my @file_list = glob "*xlsx"; my @target=(); for my $file (@file_list){ next if ($file eq $target); print "Scaning $file\n"; my $parser = Spreadsheet::ParseXLSX->new(); my $excel = $parser->parse($file); for my $sheet ( $excel->worksheets ) { my $name = $file ."_".$sheet->get_name; my ( $row_min, $row_max ) = $sheet->row_range(); my ( $col_min, $col_max ) = $sheet->col_range(); for my $row ( $row_min .. $row_max ) { for my $col ( $col_min .. $col_max ) { my $cell = $sheet->get_cell($row,$col) ; if ( $cell ){ my $val = $cell->value; if ($val =~ /\S/){ if ($target[$row][$col]){ print "WARN: Overwriting row: $row col: $col val: '$val' +\n"; } else { $target[$row][$col] = $val; } } else { print "INFO: Skipped blank $name row: $row col: $col value +: '$val'\n"; } } } } } }
poj

Replies are listed 'Best First'.
Re^2: Merging worksheets in .xls in one Excel sheet
by holli (Abbot) on Sep 21, 2017 at 15:01 UTC
    Don't bother. This is a case of "i don't understand or bother to read the answers i got and so post the same again". Such people are not worth your tie.


    holli

    You can lead your users to water, but alas, you cannot drown them.

      "You can lead your users to water, but alas, you cannot drown them."

      Please don't consider a career developing software for self driving cars :p