Google Ads Automation with Python - How to Connect to API Tutorial (#1)

Here is step-by-step instruction on how to start working with Google Ads with Python and API.
Try to watch in 1.5x speed if it’s a bit too long 🙂

00:00 Intro & Talks
01:24 Yaml Credentials
02:57 Python & PyCharm
03:59 Google Ads Library
04:57 Getting Developer Token
11:14 Getting Client ID & Secret Id
13:00 Getting refresh token
15:40 Running your first script

Useful Links:
1. Download Python
2. Download PyCharm
3. Official Library
4. My Source Code
5. Refresh token how-to
6. GAQL Builder:

This tutorial playlist:

Google Ads into BigQuery Playlist:

Read me on Medium:
Add me on LinkedIn:

📌 Want to discuss your project?
– Me on UpWork:
– Me on Fiverr:

My other Google Ads Scripts tutorials:


38 thoughts on “Google Ads Automation with Python – How to Connect to API Tutorial (#1)”
  1. Hey guys! I hope you find this video useful. It took a bit more time than usual to fill it all. So if it's a bit slow to you – increase speed of the video up to 1.25x. And share you ideas and questions with me! PS: Don`t forget you can writ me on my email or LinkedIn.

  2. do I always have to run OAuth2 to generate a new refresh token each time before running my python scripts?

  3. Hey ! Thank you so much for the video, it still helps 2 years later !
    But on the execution, the Google page show up with a 400:invalid_request error
    it seems to be caused by the redirect URI (urn:ietf:wg:oauth:2.0:oob).
    But the developer says that the redirect uri for an installed application will always have this value.
    I don't know what to do T.T

  4. Thanks for the informative video !
    But while generating refresh token facing the following issue : "Error 400: invalid_request. You can't sign in to this app because it doesn't comply with Google's OAuth 2.0 policy for keeping apps secure."
    Any inputs or comments on this issue would be really helpful.

  5. Hello there 🙂 First of all thanks for the vid! It's really helpful.
    I had one problem, Error 403 "The developer hasn’t given you access to this app. It’s currently being tested and it hasn’t been verified by Google. If you think you should have access, contact the developer" but I am the developer and it's my account… What should I do? then there was a message "If you’re the app developer, make sure that these request details comply with Google policies." But I couldn't find where to check "Google policies". Can you help out, please?

    P.S. "just spending half an hour on this video and then spending a few weeks on making it all work, this script actually runs which is an amazing success" << This was really uplifting for beginners 😀 to give us adequate estimation of time-frame 😀

  6. Hello man. First I would like to thank you so much for this detailed tutorial, it seems to be really usefull.

    I'm currently working on getting some reports from Google Ads API to a Google Colab notebook, as I previously did this with Google Analytics API. Some of the credencials and authorization issues seems to be similar, and I recognize this is the most annoying and difficult part, so your comments and this video are really helpfull!

    Only one thing I would like to alert. The "from import GoogleAdsClient" library part 4:58, where you import this library seems to be wrong. The correct library to import is from " import GoogleAdsClient". See, its NOT google_ads, but the correct syntax is googleads, after second dot.

    I'm not expert in programming, but at least for google colab notebook this is the way it worked for me. I still didn't get any reports because I'm still writing the script, but if I get any trouble or more comments I will leave it here.

    See ya!

  7. Hi guys,
    I have problem with path, what can I do?
    " from src import gads_client, config

    ModuleNotFoundError: No module named 'src'

  8. I agree. I’ve been busy with this for about a month now. Very frustrating.
    I have a few questions. Like you I also have about 20 web pages open trying to find info on the same thing.
    I need my script to run without any user interaction. So I was looking at the service account. But I am confused as it seems that I could use the app OAuth. If I use the app OAuth. Do you need to approve the connection every time the script runs, or do you only need to do this once, and then just use the refresh token that is generated?
    Then do I need an approved token for it to work, or can I used the token with the test account as indicated by the documentation? Currently when I use the service account and try to impersonate another user. It returns NOT_ADS_USER. Not sure if this is because I’m using the token in test status.

    Thanks for the video. You got my sub😀

  9. thank you for this walkthrough. my refresh token expired after 7 days – and I don't want to publish my app. Is there any way you know of to keep the refresh token active forever? Also don't want to pay for a google workspace account which would allow me to keep the oauth consent screen internal…

  10. Hey man I hope you realize this is the most thorough information regarding Google ads API access. I’ve filled out my entire yaml file before finding this and had no idea what it was used for.

    I’m not done yet but this video definitely will help me along the way.

  11. Hey! Thanks you!
    I have a problem…
    google.api_core.exceptions.PermissionDenied: 403 Request had insufficient authentication scopes.
    mb can u help me?

  12. Can we access any account with the developer token or we shld have different developer token for each MCC account?also a client id is linked to one mcc account and will change for each account

  13. It might be obvious but just want to confirm, in main(gads_client, "7036865393") function, 7036865393 is the client account id under your MCC account, 262-999-8397? I asked so because when I ran the main function with 2 following arguments, including my google-ads.yaml file and MCC account, it returned the error "Metrics cannot be requested for a manager account. To retrieve metrics, issue separate requests against each client account under the manager account."

  14. I want create a project with django. In this site the user can create campaign in google ads more fast(this is the business). Do u know if the user(client of my business) need a exclusive developer token to login in your own gads account or with my developer credentials I am able to login the different users to manage your own accounts in my project with django?

  15. Hi @Marketing Watch House. I got an error when I ran the file. It said the DEFAULT_CLIENT_ID is not defined. Would you know how to fix this error?

  16. I tried this script multiple times but I keep getting this error:
    ImportError: cannot import name 'InstalledAppFlow' from partially initialized module 'google_auth_oauthlib.flow' (most likely due to a circular import)
    Can someone pls help?

  17. Do I need to use Google Ads before applying to Google Ads API key? I tried to fill the form with no spend history in Google Ads and got rejected because of this.
    I pretend to use the API to generate keyword ideas for internal use of the company I work, it's a local news website and we pretend to perform better in SEO using keyword ideas, is that possible?

  18. Thanks a lot. Really Helpful tuts. Can you please make a tuts about " Display & Video 360 " from scratch

  19. Thanks for making this. I just have a question that can you please make a video on Google ads api for test account?

  20. hate google devs, all this and I have not even begin to code, could they just not make only a token like facebook.

    anyway ty for the vid, helped a lot.

  21. Thanks for the video! Couldn't seem to get your code from Github though? The files don't match these examples 🙂 any chance you could share again please?

  22. Thank you for uploading, I understand how challenging this API is. I am stuck at creating a testing account with a red "testing account" label. I can authenticate with OAuth2, and list accessible accounts using python But when I try to get any other information such as campaign details, or anything else, I keep getting the error of permission denied, this can only be used against test account. Although I made a separate account manager which is alos a test, but I am stuck! No help on stackoverflow either.

  23. Thanks for making this! I'm guessing the next stage is defining keywords and the bidding strategy/optimization with python?

  24. uploading google ads library is not working with me? Even when I'm trying to go on File –> sittings –> plugins I cant find google ads library.

    thanks a lot

Leave a Reply

Your email address will not be published.

Captcha loading...