SHARE
TWEET

Untitled

daibuiatp Feb 14th, 2020 155 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function checkLiveAccount() {
  2.   var ss = SpreadsheetApp.getActiveSpreadsheet();
  3.   var sheet = ss.getActiveSheet();
  4.   for (var i = 2; i < 200; i++) {
  5.     var accessToken = sheet.getRange(i, 6).getValue();
  6.     if (accessToken.length > 0) {
  7.       try {
  8.         var urlApiInfoMe = 'https://graph.facebook.com/v4.0/me?fields=id%2Cname&access_token=' + accessToken;
  9.         var response = UrlFetchApp.fetch(urlApiInfoMe);
  10.         var responseCode = response.getResponseCode()
  11.         // SpreadsheetApp.getUi().alert(responseCode);
  12.         sheet.getRange(i, 11).setBackground("#00FF00")
  13.         sheet.getRange(i, 11).setValue("LIVE");
  14.       } catch(e) {
  15.         sheet.getRange(i, 11).setBackground("#4267B2")
  16.         sheet.getRange(i, 11).setValue("CHECKPOINT");
  17.         // SpreadsheetApp.getUi().alert(e);
  18.       }
  19.     }
  20.   }
  21.   SpreadsheetApp.getUi().alert("DONE");
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top