无法从输出中删除“开始日期”到电子表格

时间:2018-03-02 08:00:48

标签: google-apps-script google-sheets google-spreadsheet-api adsense-api

我正在尝试使用Google Adsense Management API收集数据并输出到Google电子表格。

但是,虽然我只想输出“收入”(指标中的“收益”),但结果也会输出开始日期。

var ss = SpreadsheetApp.getActiveSpreadsheet(); //get current active spreadsheet
var sheet = ss.getSheetByName('name');          //sheet name
var adClientId = 'ca-pub-0000000000000000'      //adsense ID
var startDate = 'startOfMonth-1m';              //from start of last month
var endDate = 'startOfMonth-1d';                //to end of last month
var metrics = ['EARNINGS']                      //state which data to get
var domain = 'mywebsite.com';                   //filter domain name
var args = {
 'metric': metrics,
 'dimension': ['MONTH'],
 'filter': ['AD_CLIENT_ID==' + adClientId, 'DOMAIN_NAME==' + domain],
};

function report() {

 var report = AdSense.Reports.generate(startDate, endDate, args).getRows();
 sheet.getRange(16, 3, report.length, 
metrics.length+1).setValues(report);
}

0 个答案:

没有答案