Skip to content

Instantly share code, notes, and snippets.

@sinabakh
Created November 5, 2024 09:48
Show Gist options
  • Save sinabakh/b3e75f4c5ef39a8bffe505af8ff7c2e2 to your computer and use it in GitHub Desktop.
Save sinabakh/b3e75f4c5ef39a8bffe505af8ff7c2e2 to your computer and use it in GitHub Desktop.
Share Google Slides & Sheets with a list of Gmails in a Google Sheet
// Sharing Sheets
// In the Google Sheet, click on Extensions > Apps Script.
function shareSheet() {
const sheet = SpreadsheetApp.getActiveSpreadsheet();
const emailsSheet = SpreadsheetApp.openById("YOUR_SPREADSHEET_ID"); // Link to your Google Sheets file with emails
const emails = emailsSheet.getSheetByName("Emails").getRange("A1:A").getValues().flat(); // Change Accordingly
emails.forEach(email => {
if (email) {
sheet.addEditor(email);
}
});
}
// Sharing Slides
// In the Google Slides, click on Extensions > Apps Script.
function shareSlides() {
const slides = SlidesApp.getActivePresentation(); // Get the active Google Slides presentation
const emailsSheet = SpreadsheetApp.openById("YOUR_SPREADSHEET_ID"); // Link to your Google Sheets file with emails
const emails = emailsSheet.getSheetByName("Emails").getRange("A1:A").getValues().flat();
emails.forEach(email => {
if (email) {
slides.addEditor(email); // Share with each email as an editor
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment