1

I have created a Adwords Script and able to run in adwords UI.

function getCurrentAccountDetails() {
var currentAccount = AdWordsApp.currentAccount();
Logger.log('Customer ID: ' + currentAccount.getCustomerId() +
   ', Currency Code: ' + currentAccount.getCurrencyCode() +
   ', Timezone: ' + currentAccount.getTimeZone());
var stats = currentAccount.getStatsFor('LAST_MONTH');
Logger.log(stats.getClicks() + ' clicks, ' +
   stats.getImpressions() + ' impressions last month');
}

Can I run Adwords scripts in Google App Scripts, since GAS can be published as webapps so that I can give some values on demand to the Adwords Script.

I am getting below error because in GAS no access to AdwordsApp. So is there a way to communicate to Adwords Scripts using App scripts.

ReferenceError: "AdWordsApp" is not defined.

My Requirement is to create video ads by taking inputs from the user. So for this I didn't found any Adwords API details, so I want to use AdwordsScript to create video ads by taking some parameters( name, video_url etc) from the outside.

kishore
  • 413
  • 1
  • 4
  • 20
  • 1
    If you check the [Apps Script Reference](https://developers.google.com/apps-script/reference/calendar/) Adwords is not mentioned so it's safe to say that is on a domain of its own. Apps Scripts is for G Suite Services. You may also check [this post](https://stackoverflow.com/questions/17609843/adword-script-in-google-app-scripts) for additional reference. – ReyAnthonyRenacia Apr 20 '18 at 13:45
  • Would this help? https://developers.google.com/google-ads/scripts/docs/examples/apps-scripts-execution – Majal Feb 05 '20 at 01:03

2 Answers2

1

Not in any official way. There's no REST API and client libraries only exist for a handful of languages. GAS is not one of them. I was only able to find this NPM package for Node:

https://www.npmjs.com/package/adwords-api

Of course, this won't work with Apps Script, so you'll have to rewrite the code.

Anton Dementiev
  • 5,451
  • 4
  • 20
  • 32
  • 1
    This NPM package integrates with the Ads API, but the Ads API does not provide a method for executing Google Ads Scripts. – Nico Dec 13 '19 at 17:19
0

it seems you can through external API, and using OAuth libraries to connect (already included as libraries in google apps script):

https://developers.google.com/apps-script/guides/services/external

https://github.com/gsuitedevs/apps-script-oauth2

bastien
  • 209
  • 2
  • 14