You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

AdWords脚本报表:如何导出展示量大于0的数据至表格

Filter AdWords Report to Export Only Rows with Impressions > 0

Hey there! The fix here is straightforward—you just need to add a WHERE clause to your AWQL (AdWords Query Language) query to filter out rows where Impressions are 0 or less. AdWords Query Language supports standard conditional filters like this, so it's easy to tweak your existing report request.

Here's the modified code with the filter added:

function main() { 
  var spreadsheet = SpreadsheetApp.openByUrl("URL"); 
  var sheet = spreadsheet.getSheetByName( "Raw Monthly Data" ); 
  var report = AdWordsApp.report(
    "SELECT Date, AdGroupName, Clicks, Impressions, Conversions, Cost, ConversionRate, CostPerConversion, AverageCpc " +
    "FROM ADGROUP_PERFORMANCE_REPORT " +
    "WHERE Impressions > 0 " + // This line adds the critical filter
    "THIS_MONTH"
  ); 
  report.exportToSheet(spreadsheet.getActiveSheet()); 
}

A quick breakdown of what's changed:

  • The WHERE Impressions > 0 clause tells the AdWords API to only return rows where the Impressions metric has a value greater than 0.
  • Make sure the WHERE clause sits between the FROM statement and your date range (THIS_MONTH)—AWQL follows a SQL-like syntax order, so this placement is required for the query to work.
  • This adjustment ensures your exported Google Sheet will only include entries that had actual ad impressions, cutting out any zero-impression rows you don't need.

内容的提问来源于stack exchange,提问作者Andrés Nicolon

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 08:19:34