简体   繁体   中英

How I can know the limit for groups read?

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?

Your script reaches a quota or limitation.

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

在此处输入图像描述

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM