0
votes

I'm trying to obtain all current collaborators on a google sheet solely from the script editor. What is the best way to do this? I looked at the following but these only look like a way to set a key-value dict for properties. I want to automatically grab anyone who is shared on the google sheet and obtain their emails.

Again, I am trying to get a list of the emails of everyone who is shared on the google sheet. I will also take anyone who is a collaborator. This is different than the user just accessing the spreadsheet.

var documentProperties = PropertiesService.getDocumentProperties();
var scriptProperties = PropertiesService.getScriptProperties();
var userProperties = PropertiesService.getUserProperties();

I really appreciate any help! I also would love to find your source of documentation so I can improve this.

Thanks so much!

1
@Rubén thanks for your comment. They are different questions. I have updated mine. Thanksjlarks32

1 Answers

3
votes

This is written in the Google Apps Script documentation.

https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet#getEditors()

SpreadsheetApp.getActiveSpreadsheet().getEditors()

where you can replace .getActiveSpreadsheet() with .open(file), .openById(id), .openByUrl(url) as it is a method for the Spreadsheet class.

The PropertiesService is something you can use to store a kind of global variable that you can use between script runtimes or functions.