use warnings; use Spreadsheet::XLSX; my $outfile = "C:\\Users\\Owner\\Documents\\Herping\\Data\\Moon_Illum. +csv"; open my $ofh, ">", $outfile or die "cannot open $outfile: $!\n"; print $ofh ""; my $outfile2 = "C:\\Users\\Owner\\Documents\\Herping\\Data\\Moon_Phase +.csv"; open my $ofh2, ">", $outfile2 or die "cannot open $outfile2: $!\n"; print $ofh2 ""; my $excel = Spreadsheet::XLSX->new('C:\\Users\\Owner\\Documents\\Herpi +ng\\Snake_Data_2010.xlsm'); my $col = 41,; # Read col L , $col has to be a number foreach my $sheet (@{$excel->{Worksheet}}) { $sheet->{MaxRow} ||= $sheet->{MinRow}; foreach my $row ( $sheet->{MinRow} .. $sheet->{MaxRow} ) { my $cell = $sheet->{Cells}[$row][$col]; if ($cell) { my @value = $cell->{Val}; use Astro::MoonPhase; foreach my $i (@value) { my $outfile = "C:\\Users\\Owner\\Documents\\Herping\\Data\ +\Moon_Illum.csv"; open my $ofh, ">>", $outfile or die "cannot open $outfile: + $!\n"; if ($i =~ /^\d/) { (my $MoonPhase, my $MoonIllum) = Astro::MoonPhase: +:phase(($i-24107)*60*60*24+25200); push(my @Illum, $MoonIllum); print $ofh "@Illum\n"; + } } } } } foreach my $sheet (@{$excel->{Worksheet}}) { $sheet->{MaxRow} ||= $sheet->{MinRow}; foreach my $row ( $sheet->{MinRow} .. $sheet->{MaxRow} ) { my $cell = $sheet->{Cells}[$row][$col]; if ($cell) { my @value = $cell->{Val}; use Astro::MoonPhase; foreach my $i (@value) { my $outfile = "C:\\Users\\Owner\\Documents\\Herping\\Data\ +\Moon_Phase.csv"; open my $ofh, ">>", $outfile or die "cannot open $outfile: + $!\n"; if ($i =~ /^\d/) { + (my $MoonPhase, my $MoonIllum) = Astro::MoonPhase: +:phase(($i-24107)*60*60*24+25200); push(my @Phase, $MoonPhase); print $ofh "@Phase\n"; + } } } } }
In reply to Writing into Excel Worksheet by perl_n00b
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |