Any suggestions on any other perl lib which could run excel macros..
Win32::OLE perhaps...if you are running on Windows, and have Excel installed. But really, as you are creating a report, you should know which columns to group by, and which columns to subtotal. Even Excel asks you to confirm if it has guessed correctly when you hit the subtotal button. You could write a 'group by'/subtotal 'these' columns subroutine if you want to be generic about it. But then you would have to write the subtotal rows as you are writing the report, because the non-OLE library (AFAIK) cannot 'insert' rows between already written rows.