I'm trying to find out if a Google document is shared with me before I open it. I collect student work via a google form and I want to add a function to the responses spreadsheet that tells me 'if' the document is shared with me. Is this possible?
I've tried the following, but I couldn't get it to work. Plus, if it does work, it only tells me 'if' it has editors, not if the document has me as an editor.
function isShared(){
var editors = DriveApp.getFileById().getEditors()
if(editors.length > 0){
return true
}
return false
}
Target Document
Document ID's are in column G and I'd like "true" or "false" displayed in column H.
Best Answer
Short answer
1: https://developers.google.com/apps-script/guides/sheets/functions#using_apps_script_services
Explanation
From https://developers.google.com/apps-script/reference/drive/drive-app#getfilebyidid
Code
Run myFunction from the Script Editor or by using a custom menu.