How to get the file URL from file name in Google Sheets with correct Authorization via custom function/script

后端 未结 3 1864
小蘑菇
小蘑菇 2020-12-11 13:43

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:

  1. If I have a valid file nam
3条回答
  •  南方客
    南方客 (楼主)
    2020-12-11 14:25

    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.

    References:

    • Custom functions permissions
    • Custom functions access services

提交回复
热议问题