But this is assuming that current can flow through the capacitor.
The signal generator V2 won't be able to push any electrons through the capacitor because there is no return path.
Thank you for your response, is this one of the situations where it works in theory and the simulator but not in real life

?
My understanding --which might be completely wrong-- is that when there is an AC signal the capacitor will charge to the voltage potential it sees on the side that is emitting the signal (relative to this side ground).
So in this case the capacitor will charge to 3-5V(relative to the circuit on the right ground), then discharge the 3-5V to the carrying signal on the left.
I know that a transformer is the right answer, but still curious whether this in practice will work or not.
Also draw the return wire in the simulation, and add a capacitor both in the "signal" wire and in the "GND / return" wire. With only one capacitor, there is still a galvanic connection between the input and output. Then you can connect one of the sides to "GND" (or "zero" in spice) and for the rest you can create 230V and 5Vac sources and combine them at will.
I'm not exactly sure whether those sources need a DC path to the zero node. If they need it, you can add an extra Giga Ohm resistor just to make the spice simulation happy. (ngSpice needs this sometimes, other spice simulators add this implicitly when they think it's needed.
Thank you, I had a feeling that there is nothing to stop the current from passing through to the small signal side --at least in practice--, so this is a great insight.