有没有办法在 Google 应用脚本中访问 Adwords?

Is there a way to access the Adwords in Google App Scripts?

我已经创建了一个 Adwords 脚本并且能够 运行 在 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');
}

我可以在 Google 应用程序脚本中 运行 Adwords 脚本吗,因为 GAS 可以发布为网络应用程序,这样我就可以根据需要为 Adwords 脚本提供一些值。

我遇到以下错误,因为在 GAS 中无法访问 AdwordsApp。那么有没有一种方法可以使用 App 脚本与 Adwords 脚本通信。

ReferenceError: "AdWordsApp" is not defined.

我的要求是根据用户的意见制作视频广告。因此,为此我没有找到任何 Adwords API 详细信息,所以我想使用 AdwordsScript 通过从外部获取一些参数(名称、video_url 等)来制作视频广告。

不是以任何官方方式。没有 REST API,并且客户端库仅适用于少数几种语言。 GAS 不是其中之一。我只能为 Node 找到这个 NPM 包:

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

当然,这不适用于 Apps 脚本,因此您必须重写代码。

您似乎可以通过外部 API,并使用 OAuth 库进行连接(已作为库包含在 google 应用程序脚本中):

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

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