My question is quite simple but I can't figure it out. How can I create buttons in google docs spreadsheet which can be seen when logged in. I want to initialize the script upon logging into the google docs rather than going to load manually. Is there a way to do that? Also I couldn't find the nice tutorial which gives the intermediate knowledge about the google-docs function. All I could find was this simple tutorial. Another question is: Can the python script as provided by google-docs be saved and executed in google-docs itself? If it could, it can provide more functionality than simple google-functions. I am completely newbie to google docs so please bear with me.
You can create some UI elements using Google Apps Script.
https://developers.google.com/apps-script/guide_user_interfaces
Apps Script is javascript-like script that runs SERVER side, in google land. It has access to various services and google document model. But is otherwise restricted from many things that you'd think javascript can do. This is the root of most of its limitations. You can enable a script to load on start-up and hook into related events.
While there is Python and Java API to access Google Docs and their content, there is no way to to create the UI elements outside of Apps Script and the related UI Designer:
http://googleappsdeveloper.blogspot.com/2011/06/building-ui-in-apps-script-just-got.html
Related
I want to be able to run my own python script (which will basically just print out the response with a bit of formatting) whenever a new response is submitted to my google form. I looked at google's python API for forms, but it doesn't seem to have a way to set up a trigger so that the script executes when a new response is submitted. Best it can do is pull a response ID after the fact and give me the details of the response. Is there a way to do this? From what I've seen google's apps script can't do what I need it to (print stuff onto paper), so I would prefer to make a trigger for my own python script.
Any help appreciated. If the answer to this question is painfully obvious, please guide me in a good general direction because I'm totally lost.
Thanks!
You have to rethink your "solution" as the Google Forms API doesn't support triggers but Google Apps Script script does, i.e., you might make your Python program to poll the form or the linked spreadsheet.
From https://developers.google.com/forms
Automate Google Forms with simple code
Anyone can use Apps Script to automate and enhance Google Docs in a web-based, low-code environment.
Automate tasks based on Google Form submissions.
Background: Am comfortable in Python, know nothing about web deployment. I am looking into it as an alternative to compiling into .exe or .app for Win or Mac distributions.
Issue: I have a simple application that uses BeautifulSoup, openpyxl, and PySimplyGUI. It interacts with some local excel-files and creates new ones. I want to be able to, using minimum effort, make it accessible on my own web page or something similar, and make the created excel-files available for browsing/download. I have no idea how to do any of this. I've been looking into Flask and cloud foundry, but it feels like there should be some easy alternative that I'm missing. Ideally I would want a page where someone can log in (given a username and password I supply), which then directs to a page where the user can interact with my application.
Request: Is there a relatively easy way to do this that doesn't involve setting up a lot of stuff in html, etc., and where excel-files can still be interacted with by openpyxl? I ideally would just want some template, where I can "fill in the blanks" for the python method I would want to execute for each button!
Hope this makes sense. Thanks in advance :)
The easiest way to create a web app with a simple interface yet effective which does not require frontend programming is Streamlit. It is primarily used by data scientist to create simple web apps quickly.
Let's say I am creating a python-based CMS on GAE (similar to Squarespace/Shopify) which allows users to create a website.
The platform will (automatically?) create a subdomain for each new user and duplicates the application.
Now there are two options:
1) Create a new Database for the new user, WITHIN the master GAE project. (I'm worried that if one user gets a lot of traffic it might slow down ALL websites.)
2) Duplicate the entire project. (This method seems difficult to accomplish because either I have to manually create an instance of the application for each user, or I have to figure out how to hijack gcloud.py (or appcfg.py) somehow and store my login credentials in the code.)
Which choice will most likely provide the most performance for the price? Is choice 2 allowed by Google (or even possible)?
Edit:
I've done some more research about this, and it's not documented very much. I found this in the docs https://cloud.google.com/sdk/docs/scripting-gcloud which talks about running gcloud from scripts, although I don't think that means from python. I am looking into appengine-jenkins to see if it will work for my purpose. Let me know if you have any additional information about this.
Also, it seems like gcloud is adding a create command within the projects command which might be useful for me if I can figure out how to run gcloud from my script. https://cloud.google.com/sdk/gcloud/reference/alpha/projects/create
I want to be able to give out a form, with essentially 4 inputs. Each time it is submitted, I would it to trigger a python script.
I'm not totally sure where to start here. I could have the python code live on a server somewhere and have the google apps script trigger it, but ideally I could do this without having to host my code somewhere else. I also would like to avoid paying for anything...
Any and all advice would be appreciated. Please assume I have only a small amount of knowledge about this kind of stuff.
Check out this tutorial on the AppEngine documentation.
https://developers.google.com/appengine/docs/python/gettingstartedpython27/introduction
It will help you set up using Python and WebApp2 (for your forms!) and storing this data to datastore if you wish. You could just expand and modify the guestbook tutorial they make you do to have your application/script do exactly what you need it to. It's an excellent tutorial to get started even if you don't have much knowledge about python or appengine.
Im thinking of setting up a Google App that simply displays an RSS or Atom feed. The idea is that every once in a while (a cron job or at the push of a magic button) the feed is read and copied into the apps internal data, ready to be viewed. This would be done in Python.
I found this page that seems to explain what I want to do. But that is assuming Im using some of the other Google products as it relies on the Google API.
My idea was more in line that added some new content, hosted it locally on my machine, went to the Google App administration panel, pushed a button and my (locally hosted) feed was read and copied.
My questions now are:
Is the RSS (or Atom, one is enough) format specified enough to handle add/edit/delete?
Are there any flavors or such I should worry about?
Have this been done before? Would save me some work.
One option is to use the universal feed parser library, which will take care of most of these issues for you. Another option would be to use a PubSubHubbub-powered service such as Superfeedr, which will POST updates to you in a pre-sanitized form, eliminating most of your polling and parsing issues.
What about using an additional library, like for instance Feedparser?