Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

456
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda