'How to disable notification on automated sharing google app script

function addViewer() {     
  const ss = SpreadsheetApp.getActiveSpreadsheet()
  const rows = ss.getRange('A2:B').getValues().filter(r=> r[1])
  rows.map(row => DriveApp.getFileById(row[0]).addEditor(row[1]))   
} 

How to disable notification on the above code? It sents every time I run the code.



Solution 1:[1]

You should consider using the Advanced Drive API to disable share notifications.

 Drive.Permissions.insert(
   {
     'role': 'writer',
     'type': 'user',
     'value': '[email protected]'
   },
   fileId,
   {
     'sendNotificationEmails': 'false'
   });

Source

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 Amit Agarwal