We use "nested spreadsheets" that can live in any cell, and combined with aggregate functions like GROUP_BY() we're able to get this behavior.
Would be genuinely curious -- would our approach [1] help w/what you're working on?
[1] Here's an example of how we think about multiple dimensions in spreadsheets (videos + text): https://mintdata.com/docs/learn/core-mechanics/work-with-dat...