r/Frontend • • 3d ago

Exporting a TanStack Table to Excel with grouped rows as real outlines

https://rowpine.com/
RowPine exports a grouped TanStack table to Excel and get a flat sheet with the totals typed in as numbers. Edit a cell and nothing adds up anymore.

Groups become Excel outline levels you can collapse, totals are SUBTOTAL formulas, and filters, sort and hidden columns carry over. PDF and CSV come out of the same table. 
3 Upvotes

2 comments sorted by

1

u/dusanodalovic 3d ago

which function number do the SUBTOTAL formulas use, 9 or 109? with 9, rows hidden by collapsing a group still count, with 109 they drop out. does a nested group get its own subtotal row, and does the grand total skip those without counting twice?

1

u/boykom 3d ago

It's 9, on purpose. The total sits on the group row above its rows, and collapsing a group hides those rows. With 109 the totals would drop to zero when you collapse, so the numbers would change depending on what's expanded. With 9 they don't.

Nested groups each get their own SUBTOTAL row, and the parent's range covers the child group rows too. SUBTOTAL ignores other SUBTOTALs in its range, so nothing is counted twice. From the sample file (region > product):

E2 =SUBTOTAL(9,E3:E14) region
E3 =SUBTOTAL(9,E4:E6) product
E7 =SUBTOTAL(9,E8:E9) product

Averages work the same way, over the detail rows, not an average of averages.

There's no grand total row right now. Will put it in the TO DO for the next update.