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

455
Views
Google Drive to Sheet File Data Iteration

I found this very useful script on here for iteratively returning a list of file metrics by directory in GDrive. My problem is I want to add columns that exclude emails from a give domain. For example on the fileItem.getEditors I might want to return a list excluding editors in the "@mycompany.com" domain.

var childFolders = parent.getFolders();
var childFiles = parent.getFiles();
var allValues = []; // Added
while (childFiles.hasNext()){
  var fileItem = childFiles.next();
  data = [
    parentName + "/" + fileItem.getName() + "/" + fileItem.getName(),
    fileItem.getName(),
    fileItem.getMimeType(),
    fileItem.getUrl(),
    fileItem.getAccess(Session.getActiveUser()),
    fileItem.getSharingPermission(),
    fileItem.isShareableByEditors(),
    fileItem.getOwner().getEmail(),
    fileItem.getEditors().map(function(e){return [e.getEmail(), e.getName()]}).join(","),
    fileItem.getViewers().map(function(e){return [e.getEmail(), e.getName()]}).join(","),
  ];
  allValues.push(data); // Added
}
sheet.getRange(sheet.getLastRow() + 1, 1, allValues.length, allValues[0].length).setValues(allValues); // Added
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Cooper's answer is already great but you don't need to include @ on the comparison.

Filter your data by adding filter before the map that gets the email and name:

.filter(function(e){e.getDomain() != "mycompany.com"})

Output:

fileItem.getEditors().filter(function(e){e.getDomain() != "mycompany.com"})
                     .map(function(e){return [e.getEmail(), e.getName()]}).join(","),
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!