You cannot put electricity into the grid. That's one reason whole house generators diconnect your house from the grid when they run. Safety
I looked it up. I'll paraphrase.
They use an inverter. Solar power is generated via the solar panels as the sunlight hits your solar panels. The energy obtained is then converted into DC electricity, which is sent to your inverter. ... When your solar power system is producing more electricity than is required, it feeds the excess power back into the grid.