Today I learned that even if you accidentally format a memory card you may not have lost the contents. Canon cameras perform a sort of soft erase when you format the card in camera. They remove the files from easy access and mark their locations as available space to be written over but they do not actually overwrite the area with random numbers or new data which would make recovery impossible.
Canon does not endorse any particular software solution for recovering files but many of the major brands including Lexar and Sandisk bundle recovery software with their cards. A little googling also turned up Recova by Piriform https://www.piriform.com/recuva a free application that looks pretty good.
I’m not sure if the same is true of other formats and cameras but it wouldn’t surprise me at all. I’d love to hear about any experiences you’ve had.