我试图通过变量" datedFolder"将新创建的电子表格放到指定的文件夹中。有人可以帮助我吗?代码如下。
var folderName = 'Performance_Folder';
var myAccounts = ['xxxx','yyyyy'];
function main() {
var myFolder = DriveApp.getFoldersByName(folderName).next();
var formattedDate = Utilities.formatDate(new Date(), 'GMT', 'yyyy-MM-dd');
var datedFolder = myFolder.createFolder(formattedDate);
var accountSelector = MccApp.accounts();
if (myAccounts.length > 0) {
accountSelector = accountSelector.withIds(myAccounts);
}
accountSelector.withLimit(50).executeInParallel('runOnEachAccount');
}
function runOnEachAccount() {
Logger.log('Starting on: '+AdWordsApp.currentAccount().getCustomerId());
var results = getAccountReport();
Logger.log(results);
return JSON.stringify(results);
}
function getAccountReport() {
var spreadsheet = SpreadsheetApp.create(AdWordsApp.currentAccount().getCustomerId());
var report = AdWordsApp.report(
"SELECT CampaignName, AdGroupName, KeywordText, QualityScore " +
" FROM KEYWORDS_PERFORMANCE_REPORT " +
" WHERE " +
" QualityScore < 5" +
" AND Impressions > 0" +
" DURING LAST_7_DAYS");
report.exportToSheet(spreadsheet.getActiveSheet());
Logger.log("Report available at " + spreadsheet.getUrl());
}
非常感谢。谢谢!