function goThroughAllForms() {
var formInfo,arrayFormIDs,arrayFormNames,arrayOfIndexNumbers,
allFormIDsWithStringInName,i,searchStr,thisID;
searchStr = "Untitled";
formInfo= getFilesOfType();
arrayFormNames = formInfo[1];
arrayOfIndexNumbers = searchFormNamesForString(arrayFormNames,searchStr);
//Logger.log('searchStr: ' + searchStr)
//Logger.log(arrayOfIndexNumbers)
allFormIDsWithStringInName = [];
arrayFormIDs = formInfo[0];
for (i=0;i<arrayOfIndexNumbers.length;i+=1) {
thisID = arrayFormIDs[arrayOfIndexNumbers[i]];
allFormIDsWithStringInName.push(thisID);
};
Logger.log(allFormIDsWithStringInName)
};
function getFilesOfType() {
var allFormFiles,arrFileName,arrFileID,arrFileUrls,thisFile;
allFormFiles = DriveApp.getFilesByType(MimeType.GOOGLE_FORMS);
arrFileName = [];
arrFileID = [];
arrFileUrls = [];
while (allFormFiles.hasNext()) {
thisFile=allFormFiles.next();
arrFileName.push(thisFile.getName());
arrFileID.push(thisFile.getId());
arrFileUrls.push(thisFile.getUrl());
};
//Logger.log(arrFileName)
return [arrFileID,arrFileName];
};
function searchFormNamesForString(arrayFormNames,searchStr) {
var arrayIndexNumbers,i,L,thisName;
arrayIndexNumbers = [];
L = arrayFormNames.length;
for (i=0;i<L;i+=1){
thisName = arrayFormNames[i];
Logger.log(thisName);
Logger.log('thisName.indexOf(searchStr): ' + thisName.indexOf(searchStr));
if (thisName.indexOf(searchStr) !== -1) {
arrayIndexNumbers.push(i);
};
};
return arrayIndexNumbers;
};
をあなたは 'DriveApp'サービスを使用することができます。 [Apps Script Documentation - タイプ別にファイルを取得する](https://developers.google.com/apps-script/reference/drive/drive-app#getfilesbynamename)タイプには「MimeType.GOOGLE_FORMS」を使用します。 [Apps Script documentation - Mime Type](https://developers.google.com/apps-script/reference/base/mime-type) –