Edit: my preference, if it's something that has to be reusable, is to do all of this sort of thing with tools that make the end result self-service & automated. But there's a lot of one-off work too, and more complex analysis usually takes place in a stats program or R or Python, and it's much easier to paste some output from there into excel and do some nice formatting quickly rather than coding it all in a way that would make it production-ready.