remove overlaps/self-intersections

Hi!

Is there a way to do multiple boolean operations on a mesh with self-overlaps/intersections?

My mesh consists of many spheres partially overlapping. A boolean operation between the spheres could remove the overlap, but there are hundreds, so that’d take some time. Is there a script that does this automatically?

Cheers!