'Sharing different files to different emails

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 ...



Solution 1:[1]

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]))   
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 vector