-2

I have a Google Colab Workbook that does some scrapping and saves the scrapped files in my Google Drive and I also have a Google App Script that manipulates these files in Google Spreadsheet.

Is there a way to trigger this Google App Script directly from Google Colab? So at the end of my scrapping it does all the things I need it to do, without the need to open Google Apps Script.

I know I could write code in Google Colab that does exactly what the Google App Script does. But I would like to avoid that.

user3347814
  • 1,138
  • 9
  • 28
  • 50

1 Answers1

1

You might use Google Apps Script to create a web-app or you might use the Google Apps Script API then call them from Google Colaboratory by doing a HTTP request. The method to be called to execute a Google Apps Script function is script.run.

Related

Resources

Rubén
  • 34,714
  • 9
  • 70
  • 166
  • Thanks for your answer. Since there is a bounty for it, would you please provide a simple example? – user3347814 Apr 30 '22 at 00:43
  • 1
    You are welcome. Please checkout https://developers.google.com/apps-script/api/quickstart/python (already included in the answer). – Rubén Apr 30 '22 at 00:55
  • I did. And as I understand the example show how to "create a new script project, upload a file to the project, and log the script's URL", but what I need is a way to run the script. Am I missing something? – user3347814 Apr 30 '22 at 01:18
  • 1
    It looks that are referring to another page, not to https://developers.google.com/apps-script/api/quickstart/python. Try closing all the other tabs in your web browser and open the link in this comment again. – Rubén Apr 30 '22 at 01:42
  • I have opened the link in anonymous mode and it goes to the same page. I have found this https://github.com/googleapis/google-api-python-client/blob/main/docs/start.md where it seams it shows how to run a script. But I am not sure. Could you provide an example in your answer? – user3347814 Apr 30 '22 at 15:24
  • 1
    I don't know what is happing on your side. Try using another web-browser or even a different device... or just be patient – Rubén Apr 30 '22 at 15:27
  • 1
    Try this other one https://developers.google.com/apps-script/api/how-tos/execute#python – Rubén Apr 30 '22 at 15:33