Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function deleteUser() {
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
resultsheet.appendRow(["'" + userId, 'yes']);
}catch(error) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.