Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

272
Views
Script to transfer user data to (for example, a md@org.com) after deleting a user account from G Suite Admin SDK

I'm trying to develop a google script to transfer user data to (for example, a md@org.com), after deleting a user account from G Suite Admin SDK. I've tried and am unable to find it anywhere the script to transfer user data after google mail deletion. enter image description here

function onFormSubmit(e) {
 deleteUsers(e);
}
function deleteUsers() {
  var ss = SpreadsheetApp.openById('1Z0cNwh2BJLrq1bMQS3eU1tWLrjz2DLUne8CY3rMM7OE');
  var sheet = ss.getSheetByName('Delete Users');
  var data = sheet.getDataRange().getValues();

  var len = data.length;

  for(var i=1; i<len; i++){
    var user = data[i][0];
    var transferToEmail = data["Transfer to Email"][1];
    Logger.log(user);

    //use try catch in case a user is already removed
    try{
      AdminDirectory.Users.remove(user);
    }
    catch(err){}
  }
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Some Google APIs are integrated with Google Apps Script as advanced services, unfortunately the Data Transfer API isn't, that is why on How to execute Data Transfer API? are using UrlFetchApp to make a HTTP request to call the Data Transfer API instead of something like AdminDirectory to call the Directory API / Reports API.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!