There is no set of commands, in any software, that does the “please clean this messy geometry” action. With the upcoming 2.91 booleans, you could try separating this into different objects and then doing a boolean union, but looking at just that screenshot I wouldn’t say that’d be particularly fast or 100% guaranteed. Probably something like:
- Decimate planar with low angle
- Separate by loose parts
- Boolean union everything together (with 2.91 booleans that should work with overlapping and self-intersecting geometry)
Whether that would work, and how well, would depend exactly on the kind of geometry you have, and the kind of mess within. Seriously though, it’s a box. You can rebuild this in under a minute with vertex snapping.