Excavators are perhaps a good use for electric tech, because so much that an excavator does theoretically uses zero energy.
Eg. moving a pile of soil from one place to another. Picking up the soil uses energy, but when you put the bucketload down again you recoup all the energy.
Gasoline engines don't recoup the energy, and it just becomes heat in the hydraulic fluid - so much heat that excavators need cooling systems to keep the fluid cool.
I don’t think that’s how hydraulics work. You need to move oil to move the piston the other way (lowering/releasing) which means turning a pump, consuming energy.
Theoretically an excavator could be designed which uses a winch-type system to curl the bucket (maybe a highly-geared transmission from an electric motor) and then, to uncurl it, lets gravity pull it and lets the spinning winch drive a generator. I can’t think of any way to do it that isn’t extremely inefficient though.
Plus as you say, excavators don’t use a winch and motor, they use hydraulics, and I don’t think the former would be powerful enough to move lots of earth. But OP said “theoretically”, which makes them technically correct (the best kind of correct.)
There are proposed energy storage systems that involve simply lifting a lot of heavy stuff to store energy, and then lowering it again to recover it. So the idea isn’t even new. But said systems have terrible energy density (lifting and lowering stuff doesn’t store very much energy overall) and are basically a terrible idea as it is.
theoretically hydraulics can be regenerative. Whilst lowering a heavy load to the ground, the pump is being 'sucked', and the engine could be consuming no fuel during such an operation.
Practically they rarely are, because the way a piston is moved 'slowly' is to have a half-open valve with a pressure drop across it, and that half open valve wastes all the energy into heat in the fluid.
Don't excavators usually lift the dirt somewhere higher, either a mound or a dump truck? Otherwise they'd use bulldozers to push it lower/flat. Good thinking though.
Eg. moving a pile of soil from one place to another. Picking up the soil uses energy, but when you put the bucketload down again you recoup all the energy.
Gasoline engines don't recoup the energy, and it just becomes heat in the hydraulic fluid - so much heat that excavators need cooling systems to keep the fluid cool.