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

187
Views
¿Cómo puedo pasar un valor almacenado de un "mientras" a otro "mientras"?

En Google Sheet, ya he enumerado todos los archivos filtrados según sea necesario en la carpeta principal y la carpeta secundaria. También he incluido todos los detalles importantes en la hoja.

Mi problema ahora es que estoy tratando de obtener cada valor childFolderId de childFolders while y pasarlo al fileIter while y luego insertarlo en una lista de matriz para que se muestre en Google Sheet.

Aquí están los códigos:

 var parent = DriveApp.getFolderById(folderId); getChildFiles(parentName, parent, currentSheet, list, excluded);

La función principal es:

 function getChildFiles(parentName, parent, sheet) { var fileIter = parent.searchFiles("title contains 'completed'and title contains 'Verification Visit Direct Suppliers'and mimeType='application/vnd.openxmlformats- officedocument.spreadsheetml.sheet'"); var output = []; var childFolders = parent.getFolders(); while (childFolders.hasNext()) { var childFolder = childFolders.next(); var childFolderName = childFolder.getName(); getChildFiles( parentName + ' |--> ' + childFolderName, childFolder,sheet ); } while (fileIter.hasNext()) { var file = fileIter.next(); var fileName = file.getName(); var fileID = file.getId(); var path = parentName + ' |--> ' + fileName; output.push([fileID, fileName, path]); } if (output.length) { var last_row = sheet.getLastRow(); sheet.getRange(last_row + 1, 1, output.length, 3).setValues(output); SpreadsheetApp.flush(); } }

Estoy tratando de obtener childFolderId sin estropear el código de filtrado. Esto se debe a que si inserto fileIter mientras estoy dentro de childFolders while , ninguno de los archivos aparece en la hoja de Google.

Pero si divido ambos mientras logro enumerar todos los archivos que necesito excepto el childFolderId

¿Cómo puedo obtener el valor de childFolderId e insertarlo en la hoja?

about 4 years ago · Juan Pablo Isaza
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!