Offline Conversion


Upload of offline conversion data from Google Spreadsheet(Specify spreadsheet ID)


function uploadSpreadSheetData() {
  const accountId = AdsUtilities.getCurrentAccountId();
  const SPREAD_SHEET_ID = '111112222233333AAAABBBBBCCCCC';
  const SPREAD_SHEET_NAME = 'sheetName';
  let sh = SpreadsheetApp.openById(SPREAD_SHEET_ID).getSheetByName(SPREAD_SHEET_NAME);
  let dataArray = sh.getDataRange().getValues();
  let fileContent = '';
  dataArray.forEach(row => {
    fileContent += row + '\n';
  });
  const offlineConversions = Display.OfflineConversionService.upload(
    accountId,
    'uploadSpreadSheetName',
    fileContent
  ).rval;
}