in reply to Re^4: Copying data sets of varying size into excel using OLE
in thread Copying data sets of varying size into excel using OLE

And now that you have the method for formatting properly, you may want to register - join the Monastery -- and read more of the docs suggested above: both those about PM and those that document various functions and modules.
  • Comment on Re^5: Copying data sets of varying size into excel using OLE

Replies are listed 'Best First'.
Re^6: Copying data sets of varying size into excel using OLE
by Anonymous Monk on Sep 09, 2010 at 16:39 UTC

    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 ;)