It seems that if some rows of my spreadsheet are grouped, then sorting any section of those rows produces strange results. It seems that the rows I'm attempting to sort become cleared and removed from the group. In Excel, sorting in these scenarios works as expected. Is there a way to make this work?
Please see attached files for the code I'm using, and my test input and output files. In addition, I was unable to remove the row groupings through code; possibly my code is wrong? The call to UngroupRows gave a null reference exception.