in reply to Re^5: Copying data sets of varying size into excel using OLE
in thread Copying data sets of varying size into excel using OLE
The answer to my question involved me learning how to get Perl to assess the size of the data set to be pasted, making it easy to pass this to the Range() in excel. It's a messy method to my mind, but it works well enough for the project i'm working on. Here it is in case another beginner needs to find it.
# Define data range my $sum = 0; foreach my $line (@$array) { $sum += scalar(@$line); } my $rows = scalar(@$array); my $cols = $sum/scalar(@$array); my $rng1 = "A1"; ### hard-coded starting position my @num = ("A" .. "Z"); my $num2 = $num[$cols-1]; my $rng2 = "$num2"."$rows"; # Copy data to excel range $sheet -> Range("$rng1:$rng2") -> { 'Value' } = $array;
Thank you all for your helpful comments on formatting ;)
|
|---|