I would like to create a custom function that pulls a Drive URL from a file name in Google Sheets.
So, using the code below:
Custom functions runs as if run by a anonymous animal(user). ScriptApp.getOAuthToken will return a anonymous token without the required scopes. What you're attempting is not possible, unless the file in question is public.
ScriptApp.getOAuthToken