" I accidentally formatted it"
“accidentally”!! Really!! How does one “accidentally” format a drive?
“all the files have went missing”
That is what formatting does.
Without knowing what was on it originally it’s hard to suggest how to reload them.