I use a couple on a HO museum layout. They've proved very reliable and much less trouble than the train detector-switch machine system
that was in use. If HO pilot trucks will work them, G shouldn't be a problem.
I used a length of piano wire as the spring.
I haave a couple of Aristo switches that are sprung. No motors, just Ozark switch stands connected to the throw bar with some wire coiled into a spring. It takes a little fiddling to get it right, then some PM during the year to keep it working.