in reply to Re: Sorting spread sheets in Perl via OLE Excel
in thread Sorting spread sheets in Perl via OLE Excel

hi, I need to sort my sheet by first column then by 2nd column then by 3rd column. Do you know how I can do this? I know the topic is 13 years old but I really need this :p Thanks by advance :)
  • Comment on Re^2: Sorting spread sheets in Perl via OLE Excel

Replies are listed 'Best First'.
Re^3: Sorting spread sheets in Perl via OLE Excel
by 1nickt (Canon) on Oct 18, 2017 at 12:11 UTC

    Can you sort the data with Perl before writing to the spreadsheet?


    The way forward always starts with a minimal test.
      nope,

      My spreadsheet is built with others spreadsheets, some data can be identical in those spreadsheet, so i have to write identical data once.

      I guess it would make the algorithm very slow and complicated if i had to sort datas before writing in the spreadsheet.

      But anyway, I found my answer some minutes after I asked for help. Here's the answer if some people need it ;) :

      my $SortOrd1 = $Sheet->Range("A2"); my $SortOrd2 = $Sheet->Range("B2"); my $SortOrd3 = $Sheet->Range("C2"); my $Selection = $Sheet->Range("A:M"); $Selection->Sort( {Key1 => $SortOrd1, Order1 => xlAscending, Key2 => $SortOrd2, Order2 => xlAscending, Key3 => $SortOrd3, Order3 => xlAscending, });