Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

461
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda