Google Sheets API Automation in Python

Поделиться
HTML-код
  • Опубликовано: 7 янв 2025

Комментарии • 93

  • @knalsgtes6684
    @knalsgtes6684 Год назад +11

    This is it! The tutorial that we've looking for. Very helpful for our new automation project. Looking forward for more automation tutorials. Done subscribe.

  • @MZubair-ql4rn
    @MZubair-ql4rn 9 месяцев назад +1

    Thank You dear,your typing speed is awosome

  • @LlaneRost
    @LlaneRost Год назад +3

    Love watching you videos on my phone I always need my magnifying glass. Would love to see the text zoomed in a bit.

  • @mbeware
    @mbeware Год назад +3

    I was in the process of setting up an ETCD server for storing just a few shared variables. This would be perfect for our use case! Thanks!

  • @bozok1903
    @bozok1903 Год назад +1

    I did my first app yesterday using google sheets and looking for a good tutorial to go further. Thank you for the video.

    • @susanca8443
      @susanca8443 Год назад

      Congrats. Please can you describe what the app does?

    • @bozok1903
      @bozok1903 Год назад

      @@susanca8443 It was an expance tracker. I used google sheets as a database.

  • @cassiuslives4807
    @cassiuslives4807 Год назад +3

    18:58 googleapiclient.http.HttpRequest no longer has a method called "get", so the line *values = result.get("values",[]) fails

  • @prof.code-dude2750
    @prof.code-dude2750 Год назад +2

    The best video for this topic! Loved it

  • @valentinasinichenko751
    @valentinasinichenko751 7 месяцев назад

    Amazing! Thank you for enabling me to get the job done so easily and getting me through all of the google api settings

  • @filltofill
    @filltofill Год назад +1

    After first excecution on my local machine, script can run on a sever/cloud under cron task for example? In other words: does the authorization process depends on the machine under the script is running?

  • @facundolubo
    @facundolubo Год назад

    I have an error at 18:50: "No se puede acceder a este sitio webLa página localhost ha rechazado la conexión.
    Prueba a:
    Comprobar la conexión
    Comprobar el proxy y el cortafuegos
    ERR_CONNECTION_REFUSED"

  • @marchef7291
    @marchef7291 5 месяцев назад +1

    the best video to learn google sheets api, Thanks!

  • @linusheterlinus
    @linusheterlinus Год назад

    At 6:43 when he is storing the file. I don't get the option to store it as a Json File.
    For me it autosaves as HTML / text document.
    Please can someone help me out? Thanks!

  • @omnitechsolutions1056
    @omnitechsolutions1056 6 месяцев назад

    Awesome video ! Complete explanation, This was the video i was searching for Thanks a ton bro :)

  • @susanca8443
    @susanca8443 Год назад +1

    Any reason you didn't use gspread? I use it and you install only that. The entire code one just three lines to authenticate and get the data.

  • @soroushjamali492
    @soroushjamali492 Год назад +2

    Thanks, this is super helpful! How can we modify the code so that it gets triggered when there is a change in the sheet?

  • @MrBossclub
    @MrBossclub Год назад +4

    Does the cloud service sheet api cost anything?

  • @ukaszbudzynski9113
    @ukaszbudzynski9113 Год назад

    Great explanation! Very valuable, that You took us through the authentication and credential process...thanks!

  • @diegomgarcia00
    @diegomgarcia00 11 месяцев назад +2

    Great video! If I wanted to automate it even more, how can I trigger this code to run every time a new row gets added or a cell gets updated?

    • @matthewhuang5111
      @matthewhuang5111 3 месяца назад

      probably better to use the app script built-in extension of google sheets if you want to set a trigger, or use GCP scheduler if you want to use it in python

  • @amardeepyadav9511
    @amardeepyadav9511 8 месяцев назад +1

    Hey, man you seems the most intelligent guys among the youtube community.

  • @davidtindell950
    @davidtindell950 11 месяцев назад

    Great! Very Helpful !! Thank You Again !!!

  • @rublevv
    @rublevv Год назад

    Brilliant tutorial! Thank you, it was superhelpful.

  • @hizokadarkwolf
    @hizokadarkwolf Год назад +2

    Great introduction, it helped me a lot. Thanks.
    Q: Why not use a Service Account instead? If I manage to make it work, I will share the code as a reply to this comment.

    • @Sabre00
      @Sabre00 Месяц назад

      This comment sent me down the service account rabbit hole and I actually got it to work but with Google Forms, as I find that to be more suitable for my application versus the Google Sheets. Did you ever get yours to work?

  • @MrPelastus
    @MrPelastus 2 месяца назад

    Thank you for this video. Is it possible to actually add new rows of data from python, instead of only updating existing rows/cells?

  • @JackWaldron-y1k
    @JackWaldron-y1k Год назад +4

    Hey NeuralNine, do you have a video on the Keyboard shortcuts you use while developing in pyCharm? Some of these look really useful!

  • @GauravKVerma-kx3ex
    @GauravKVerma-kx3ex 2 месяца назад

    what I don't to use web auth. I want to run the app 100% at the backend, is it possible to just use the API key?

  • @grigorii_matiushkov
    @grigorii_matiushkov Год назад +1

    Hello, the following error appears: FileNotFoundError: [Errno 2] No such file or directory: 'credentials.json'. Although the credentials file.json is in the python project folder. Help please

    • @Idk-mk9cg
      @Idk-mk9cg Год назад +1

      Same problem, have you found the solution?

    • @WHATEVER-y8o
      @WHATEVER-y8o Год назад

      same thing have you found solution?@@Idk-mk9cg

    • @halasyamv3190
      @halasyamv3190 Год назад +1

      @@Idk-mk9cg the solution is you need to name that json file he downloads in the beginining credentials and then save it in the directory that you are working in

    • @sowdah
      @sowdah 11 месяцев назад

      SPECIFY ABSOLUTE PATH. If anyone else has this error, replace the "credentials.json" with its absolute file path. E.g. line 22 could mention "d:\CODEFOLDER\SHEETSPROJECT\credentials.json" instead of just "credentials.json"

  • @scottnorman2296
    @scottnorman2296 Год назад

    Excellent tutorial. Thank you!

  • @severtone263
    @severtone263 Год назад

    Great tutorial buddy. You earned a sub

  • @brany2920
    @brany2920 Год назад

    hi, i was using your example but got messed up wityh the security applied (oauth) . is there a way to use service instead???

  • @aleksalukic1904
    @aleksalukic1904 Год назад +3

    after i run the script google said :
    error : 400 redirect_uri_mismatch google

  • @techanil6835
    @techanil6835 5 месяцев назад

    Can you show how to creat tab level user acces management for Google sheets by python

  • @akabaneaditya9469
    @akabaneaditya9469 Год назад

    thanks for your video, may i ask how to get the lattest row in gspead, 9i want to run log histrory from many devices

    • @zhihengjiang
      @zhihengjiang 2 месяца назад

      U can got the last row by,
      sheets = service.spreadsheets()
      # 获取电子表格的数据
      result = sheets.values().get(
      spreadsheetId=sheet_id,
      range="Sheet1"
      ).execute()
      # 获取所有数据行
      rows = result.get('values', [])
      # 找到实际有数据的最后一行
      if rows:
      last_row_with_data = len(rows)
      else:
      last_row_with_data = 0

  • @talhatasova1296
    @talhatasova1296 Год назад +2

    Would it be easier with the library called pygsheets? As far as I know, that whole authentication process and data manipulation operations take less amount of code and time. Is there any disadvantages of it? Great video btw, recently discovered the channel as an intermediate python developer, been improving already ^^

    • @completelybear
      @completelybear Год назад +4

      Pygsheets and/or gspread worked for me. Can manipulate the chosen cells as a pandas dataframe which makes it really handy!

  • @javiermorales5884
    @javiermorales5884 Год назад

    Background:
    So I have two gmail accounts. For some reason with one of the email I am not able to create a projects, this being a university email. I created my project with a personal email and wrote a script resembling yours. the sheet is created by university email so the personal one does not have access.
    Question:
    At what point in your code does it tell which google account is running the code? or does the project creator always need access to the google file even if its another user?
    or is it that since i ran the code and when asked for the account, such as you were when you first ran it, I selected the account without access?

    • @javiermorales5884
      @javiermorales5884 Год назад

      just run the
      else:
      -----------
      with ()
      the two parts before the try

  • @VishnuVardhan-Developer
    @VishnuVardhan-Developer Год назад

    When I try to run the first code which displays, all the data in the excel; a error occurs saying
    'HttpRequest' object has no attribute 'get'

  • @vladvol855
    @vladvol855 Год назад +10

    It is so complicated to set this configuration! Much easier to work via Excel, than this spreadsheets

    • @jamestheyoucause2124
      @jamestheyoucause2124 4 месяца назад

      This can be beneficial for teams. If the sheet has data that the team needs access.

  • @ogarjosephodama1878
    @ogarjosephodama1878 Год назад +1

    I think you should use real life case like inventory management system sheet

  • @kylewilliams4721
    @kylewilliams4721 Год назад +1

    Where's the code in your github? There's a bunch

  • @abdullahburakgun7112
    @abdullahburakgun7112 Год назад

    Is it possible to refresh pivot table from python code ?

  • @aroobae456
    @aroobae456 11 месяцев назад

    I am gettint the error message: 400 redirect_uri_mismatch :(

  • @siddharthkshirsagar2545
    @siddharthkshirsagar2545 Год назад

    Awesome video Thanks for this

  • @myvideos715
    @myvideos715 Год назад

    Thats what i was looking for ❤

  • @findsarfaraz
    @findsarfaraz Год назад

    do you have to pay ? I am really afraid of using Google Cloud

  • @clmvdstap
    @clmvdstap 10 месяцев назад

    Thanks a lot, usefull demo.

  • @sizemccuse212
    @sizemccuse212 Год назад +1

    Hello great video, though I followed all the steps and when I try to write to the sheet it gives me an error saying ‘ACCESS_TOKEN_SCOPE_INSUFFICIENT’

    • @paololigori
      @paololigori 11 месяцев назад +1

      did you solve this man?

  • @CaioMGA
    @CaioMGA Год назад

    Thank you so much for your tutorial

  • @150nitrodude
    @150nitrodude 11 месяцев назад

    Great tutorial, but I must say, it would be WAY easier to do this natively in Google Apps Script. The merits I see of using python would be to package the code into a Cloud function or something similar, but even then - juice might not be worth the squeeze. For those saying, "I only know Python", Apps Script is a slightly easier version of JS, so it wouldn't be hard for y'all to do what you need to do.

  • @sowdah
    @sowdah 11 месяцев назад +1

    If you get 'FileNotFoundError', try to specify an absolute path. Replace the "credentials.json" with its absolute file path.
    E.g. line 22 could mention "d:\CODEFOLDER\SHEETSPROJECT\credentials.json" instead of just "credentials.json"
    Tags : Errno 2. FileNotFoundError . No such file or directory . Folder . Can't Cant Find . Traceback . Same .

  • @DevOpsConsultantGuru
    @DevOpsConsultantGuru Год назад

    Bro you are great!!

  • @Patronesofly
    @Patronesofly 9 месяцев назад

    how can we all all the data and put it in pandas?

  • @leo.troshchinskiy
    @leo.troshchinskiy Год назад

    Does anybody know why googleapiclient does not install in Pycharm?

  • @bisyrim1030
    @bisyrim1030 Год назад

    Hello friend, I think your content is excellent. but, can you make another example of storing data into a G sheet from a list or etc.

  • @genelkanininaksine
    @genelkanininaksine Год назад

    Great tutorial.

  • @noyou9349
    @noyou9349 Год назад

    I'm getting an error : 'Credentials' has no attribute 'from_authorized_user_file'

    • @jorgeduardo101
      @jorgeduardo101 Год назад

      use the following:
      "from google.oauth2.credentials import Credentials" instead of the line used in the video and it should work

    • @neilorourke814
      @neilorourke814 8 месяцев назад

      @@jorgeduardo101 holy crap thankyou

  • @soufianesoufiane7218
    @soufianesoufiane7218 10 месяцев назад

    Yes, more about Flask

  • @AqeemJones-cy7ym
    @AqeemJones-cy7ym 4 месяца назад

    I received the error " ModuleNotFoundError: No module named 'google' " Please help

    • @AqeemJones-cy7ym
      @AqeemJones-cy7ym 4 месяца назад

      I figured it out!! I will explain it below for Others facing the same issue:
      The above response means that " Python can't find the google module, which ultimately means that the necessary libraries (All or Some) haven't been installed in your environment "
      To double check this, I used CHATGPT with the following Prompt, ending it with Copy/Pasting the status code error output on my IDE.. here is the prompt:
      "What does this mean
      when receiving error in Pycharm IDE
      trying to import modules for automating Google Sheets: [ PASTE YOU STATUS CODE ERROR OUTPUT]
      I then could see that I was missing a few modules in order to run the above video time [09:32] successfully.
      Once all modules was added successfully, I then try'd again and it worked with no errors as seen above!

  • @fusebox9725
    @fusebox9725 10 месяцев назад

    I'm getting a developer permission error..

  • @nadernofal7087
    @nadernofal7087 Год назад

    thank you alot man!!

  • @wtfdoiputhere
    @wtfdoiputhere 9 месяцев назад

    Tbh google app script is much better and more straightforward bcz that's basically its main function, to automate

  • @АртемЧерных-д5х
    @АртемЧерных-д5х 10 месяцев назад

    Thank you so much!

  • @newbieprogrammer-qs3bq
    @newbieprogrammer-qs3bq 11 месяцев назад

    i keep getting
    Traceback (most recent call last):
    File "e:\google sheets project\project.py", line 47, in
    main()
    File "e:\google sheets project\project.py", line 41, in main
    values = result.get("values", [])
    ^^^^^^
    NameError: name 'result' is not defined

  • @babywaffles
    @babywaffles Год назад

    Doesn't work...

  • @mehdismaeili3743
    @mehdismaeili3743 Год назад

    excellent.

  • @tcgvsocg1458
    @tcgvsocg1458 Год назад

    good video

  • @mikkodarobloxian6316
    @mikkodarobloxian6316 Год назад

    awesome

  • @girishkuvalekar3965
    @girishkuvalekar3965 Месяц назад

    Gspread seems better

  • @pawelp531
    @pawelp531 Год назад

    I am getting "TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond" when it executes the "result = sheets.values().get(spreadsheetId=SPREADSHEET_ID..." line with firewall off.

  • @дядяФедор-м2ч
    @дядяФедор-м2ч Год назад

    хороший , молодец, www забыл

  • @SuperN1
    @SuperN1 7 месяцев назад

    👍

  • @muneebbolo
    @muneebbolo 6 месяцев назад

    getting this error:
    Traceback (most recent call last):
    File "C:\Users\PC\Downloads\GoogleSheets_Project\connect_to_sheets.py.txt", line 45, in
    main()
    File "C:\Users\PC\Downloads\GoogleSheets_Project\connect_to_sheets.py.txt", line 23, in main
    flow = InstalledAppFlow.from_client_secrets_file("credentials.json", SCOPES)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\PC\AppData\Roaming\Python\Python312\site-packages\google_auth_oauthlib\flow.py", line 198, in from_client_secrets_file
    with open(client_secrets_file, "r") as json_file:
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    FileNotFoundError: [Errno 2] No such file or directory: 'credentials.json'
    [Finished in 1.9s]

  • @ogarjosephodama1878
    @ogarjosephodama1878 Год назад

    I think you should use real life case like inventory management system sheet