Organiza tus páginas con colecciones Guarda y categoriza el contenido según tus preferencias.
CarpetaIterator
Es un objeto que permite que las secuencias de comandos iteren sobre una colección potencialmente grande de carpetas. Se puede acceder a los iteradores de carpetas desde DriveApp, File o Folder.
// Log the name of every folder in the user's Drive.constfolders=DriveApp.getFolders();while(folders.hasNext()){constfolder=folders.next();Logger.log(folder.getName());}
Obtiene el siguiente elemento de la colección de archivos o carpetas.
Documentación detallada
getContinuationToken()
Obtiene un token que se puede usar para reanudar esta iteración más adelante. Este método es útil si el procesamiento de un iterador en una ejecución superaría el tiempo máximo de ejecución. Por lo general, los tokens de Continuation son válidos durante una semana.
Volver
String: Es un token de Continuation que se puede usar para reanudar esta iteración con los elementos que permanecieron en el iterador cuando se generó el token.
hasNext()
Determina si llamar a next() mostrará un elemento.
Volver
Boolean: true si next() muestra un elemento; false si no
next()
Obtiene el siguiente elemento de la colección de archivos o carpetas. Arroja una excepción si no queda ningún elemento.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-07-26 (UTC)"],[[["\u003cp\u003e\u003ccode\u003eFolderIterator\u003c/code\u003e enables scripts to iterate through a large collection of folders within Google Drive.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods like \u003ccode\u003ehasNext()\u003c/code\u003e to check for more folders, \u003ccode\u003enext()\u003c/code\u003e to retrieve the next folder, and \u003ccode\u003egetContinuationToken()\u003c/code\u003e for handling lengthy iterations.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can utilize \u003ccode\u003eFolderIterator\u003c/code\u003e with \u003ccode\u003eDriveApp\u003c/code\u003e, \u003ccode\u003eFile\u003c/code\u003e, or \u003ccode\u003eFolder\u003c/code\u003e objects to access and process folders programmatically.\u003c/p\u003e\n"]]],["FolderIterator allows iterating over a large collection of folders. Key actions include using `hasNext()` to check for the next item and `next()` to retrieve it. `getContinuationToken()` provides a token to resume iteration later, helpful for large collections. The example shows how to log every folder's name in a user's Drive, demonstrating iteration through the folder collection. The iterator returns folder objects and can throw an exception if no items remain.\n"],null,["FolderIterator\n\nAn object that allows scripts to iterate over a potentially large collection of folders. Folder\niterators can be accessed from [DriveApp](/apps-script/reference/drive/drive-app), a [File](/apps-script/reference/drive/file), or a [Folder](/apps-script/reference/drive/folder).\n\n```javascript\n// Log the name of every folder in the user's Drive.\nconst folders = DriveApp.getFolders();\nwhile (folders.hasNext()) {\n const folder = folders.next();\n Logger.log(folder.getName());\n}\n``` \n\nMethods\n\n| Method | Return type | Brief description |\n|---------------------------------------------------|-----------------------------------------------|-------------------------------------------------------------------------|\n| [getContinuationToken()](#getContinuationToken()) | `String` | Gets a token that can be used to resume this iteration at a later time. |\n| [hasNext()](#hasNext()) | `Boolean` | Determines whether calling [next()](#next()) will return an item. |\n| [next()](#next()) | [Folder](/apps-script/reference/drive/folder) | Gets the next item in the collection of files or folders. |\n\nDetailed documentation \n\n`get``Continuation``Token()` \nGets a token that can be used to resume this iteration at a later time. This method is useful\nif processing an iterator in one execution would exceed the maximum execution time.\nContinuation tokens are generally valid for one week.\n\nReturn\n\n\n`String` --- a continuation token that can be used to resume this iteration with the items that\nremained in the iterator when the token was generated\n\n*** ** * ** ***\n\n`has``Next()` \nDetermines whether calling [next()](#next()) will return an item.\n\nReturn\n\n\n`Boolean` --- `true` if [next()](#next()) will return an item; `false` if not\n\n*** ** * ** ***\n\n`next()` \nGets the next item in the collection of files or folders. Throws an exception if no items\nremain.\n\nReturn\n\n\n[Folder](/apps-script/reference/drive/folder) --- the next item in the collection"]]