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 > 0clause tells the AdWords API to only return rows where the Impressions metric has a value greater than 0. - Make sure the
WHEREclause sits between theFROMstatement 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
相关产品推荐
相关产品推荐

