Photos missing in both gallery and google photos
Formatting your SD card shall not delete the synced items from your Google photos account.

Google photos app also shows your offline photos. So, unless they were uploaded to the cloud drive, they are now gone and cannot be recovered.

Please check once by logging into your account at photos.google.com. If your photos appear there, then they are in the cloud and you can safely get them back on your device.