in reply to Re^3: Spreadsheet::WriteExcel; combining xls into one
in thread Spreadsheet::WriteExcel; combining xls into one

Hi poj ! Thank you for the code. It was short and sweet, eliminate all the long-winded code that I had.

I will remember to give more descriptive name for variables, but sometimes Idk how to name them, im bad at it

I got the new data, now the different xls files are at "$path/$modes/result.xls"

They are all sharing same name but in different directory.

Also I am concern on how to change the sheet name? Instead of taking the substring from the states' name? Coz for states like South Carolina, South Dakota and etc, I wasn't sure how to name it accordingly, I'm planning to name it as the same in postal code.

Apologize for the changes, I should've know the file/directory/name would have different pattern from time to time.
  • Comment on Re^4: Spreadsheet::WriteExcel; combining xls into one

Replies are listed 'Best First'.
Re^5: Spreadsheet::WriteExcel; combining xls into one
by poj (Abbot) on Jun 13, 2017 at 07:20 UTC

    Take a look at File::Find::Rule. For example

    #!/usr/bin/perl use strict; use File::Find::Rule; use Data::Dump 'pp'; my $path = '/abc'; my $rule = File::Find::Rule->new; $rule->file->name( 'result.xls' ); my %source=(); for my $filename ( $rule->in($path) ){ my @f = split '/',$filename; my $mode = $f[-2]; $source{$mode} = $filename; }; pp \%source;
    poj