How I can know the limit for groups read?

113 Views Asked by At

I'm working into the migration of a large list to Google Groups from Google Apps Script.

After some creation of members, i'm having this Exception:

Exception: Service invoked too many times for one day: premium groups read.

There is one way to know the available quote of reads for integrate this verification into my code.

This is my function:

function readSheet(){
    var sheetId='MY-ID';
    var sheet = SpreadsheetApp.openById(sheetId);
    var toIgnore = 1;
    var mData = sheet.getDataRange().offset(toIgnore, 0, sheet.getLastRow() - toIgnore).getValues();

    for (var i = 0; i < mData.length; i++) {
        /*Here verify quota*/
        addUsertoGroup(mData[i][0]);
    }
}

How I can achieve this?

1

There are 1 best solutions below

8
On

Your script reaches a quota or limitation.

You can see the daily quotas for Groups read in the table below:

enter image description here

You can use a try..catch statement to ignore the error:

function readSheet(){
    var sheetId='MY-ID';
    var sheet = SpreadsheetApp.openById(sheetId);
    var toIgnore = 1;
    var mData = sheet.getDataRange().offset(toIgnore, 0, sheet.getLastRow() - toIgnore).getValues();

    for (var i = 0; i < mData.length; i++) {
      try{
        addUsertoGroup(mData[i][0]);
      }
      catch(e){
        console.log("The script reached the daily quota: ",e);
      }
}
}