package StatementExcel; require Exporter; @ISA = qw(Exporter); @EXPORT = qw(LoadExcel ProcessPreparedSheet); use strict; use warnings; use Encode; use 5.014; use utf8; use Win32::Console; use autodie; use warnings qw< FATAL utf8 >; use Carp; use Win32::OLE qw(CP_UTF8); use Win32::OLE::Const 'Microsoft Excel'; use Cwd; use Text::CSV::Unicode; use File::BOM qw( :all ); use List::MoreUtils 'first_index'; sub LoadExcel { Win32::OLE->Option(CP => CP_UTF8); # set utf8 encoding binmode(STDOUT, ':unix:utf8'); binmode $DB::OUT, ':unix:utf8' if $DB::OUT; # for the debugger Win32::Console::OutputCP(65001); # Set the console code page to UTF8 my ($i,$j,$StatementRef); my ($xlApp, $xlBook, $Sheet, $rng, $tbl, $xlFile, $RowRecStart, # line where statement records will start $ColRecStart, # column where statement records will start $StatementRows, # number of statement rows $HeadingRange, $RecordsRange); my (@Statement, @Heading); my @columns = ('a'..'z'); $Win32::OLE::Warn = 2; my %parms = @_; # ... more code $xlApp = Win32::OLE->new('Excel.Application'); # Start Excel and make it visible # ... more code