Extract Data from Ads Report to Spreadsheet
Hi I am trying to write a script that will extract the data from Google Ads Report (Call Details) or 'call_metrics_call_details_report' to a spreadsheet automatically. I have been able to extract all the details successfully - except for the caller phone number. There also does not seem to be a google attribute for this. Can anybody help? Thank you
function importCallDetails() { var accountId = AdWordsApp.currentAccount().getCustomerId(); var startDate = "INSERT_START_DATE_HERE"; var endDate = "INSERT_END_DATE_HERE"; var query = "SELECT CallStartTime, CallDuration, CallerCountryCallingCode, CampaignName, CampaignId " + "FROM CALL_METRICS_CALL_DETAILS_REPORT"; var report = AdsApp.report(query); var data = report.rows(); var spreadsheetUrl = 'https://docs.google.com/spreadsheets/*********/'; var spreadsheet = SpreadsheetApp.openByUrl(spreadsheetUrl); var ss = spreadsheet.getSheetByName('PAGE1'); ss.clearContents(); report.exportToSheet(ss); } function main() { importCallDetails(); }