Home > database >  Sharing different files to different emails
Sharing different files to different emails

Time:03-23

I want to sharE each file (by file id) in A column with the email in B column as (Editor). Example: I want to share file in A2 with the email in B2 and share share file in A3 with the email in B3 ...

CodePudding user response:

Based on your problem statement, try following sample script :-

function addEditor() {     
  const ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(your sheet Name); // replace sheet name
  const rows = ss.getRange('A2:B').getValues().filter(r=> r[1])
  rows.map(row => DriveApp.getFileById(row[0]).addEditor(row[1]))   
}
  • Related