Created
December 6, 2018 19:21
-
-
Save jing-jin-mc/0a5d8af8efb6f40ac5801cebc21bc07f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function myFunction() { | |
var activeSpreadsheet = SpreadsheetApp.getActiveSpreadsheet(); | |
var sheet = activeSpreadsheet.getSheetByName('Main'); | |
var resultsheet = activeSpreadsheet.getSheetByName('Result'); | |
var userInputs = sheet.getRange("A3:B").getValues(); | |
var webPropertyId = String(userInputs[0][0]); | |
var numClients = userInputs[0][1] | |
for (var i = 0; i<numClients;i++){ | |
var typeOfId = String(userInputs[2+i][1]); | |
var userId = String(userInputs[2+i][0]); | |
try { | |
var request = { | |
"kind": "analytics#userDeletionRequest", | |
"id": { | |
"type": typeOfId, | |
"userId": userId | |
}, | |
"webPropertyId": webPropertyId | |
}; | |
Analytics.UserDeletion.UserDeletionRequest.upsert(request); | |
resultsheet.appendRow(["'" + userId, 'yes']); | |
}catch(error) { | |
Browser.msgBox(error.message); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment