I dont even know if this is possible. But if it is, can someone give me the broadstrokes on how I can use a Python script to populate a Google spreadsheet?
I want to scrape data from a web site and dump it into a google spreadsheet. I can imagine what the Python looks like (scrapy, etc). But does the language support writing to Google Drive? Can I kick off the script within the spreadsheet itself or would it have to run outside of it?
Ideal scenario would be to open a google spreadsheet, click on a button, Python script executes and data is filled in said spreadsheet.
Google GData (library with interfaces for all Google services) Python client:
https://code.google.com/p/gdata-python-client/
Spreadsheets API docs (linked from previous page):
https://developers.google.com/google-apps/spreadsheets/?csw=1
The question is from 2013. But still, as I was interested today by the answer, I though it could help some other people :
Google developed GScript, equivalent of VBA from Microsoft. I guess with this language you can easily scrape web data and include them into the sheet.
Otherwise, if you want to use Python, here is a great tutorial explaning how to use Google API v4:
https://developers.google.com/sheets/api/quickstart/python
The missing step: launching python script directly from the google sheet.
I hope it helps !
Yes, it is possible and this is how I am personally doing it so.
search for "doGet" and "doPost(e)
Related
I have access to a bloomberg terminal and python on the same computer. I tried to look on internet and on this forum for some useful tips/introduction to automate bloomberg tasks, although I didn't find anything. How can the terminal be automated? Is it possible to do something similar to webscraping with an external application? Or the only way is to use Sendkeys method? (In my case I want to automate ISIN typing, print screen (for which I found a code in this forum using API calls) and data analysis (so scrape the data showed). I'm aware of bloomberg add-in for excel but it's quite limited.
Automating the terminal can be done using the TerminalConnect Api.
It's not possible to 'scrape' data from the terminal, but you can access data using the Desktop Api (DAPI).
What you want is to use the API.
Bloomberg makes it easy to do this in Excel. You need to install Bloomberg API plugin.
If you need to do this ‘programmatically’, there are API written in different languages. Use WAPI in your terminal to find out.
Hey all I am looking to use GAE to listen to one of my Google sheets pages and then execute a python script based of what was entered. I have already setup the python and sheets interaction, meaning I can now read everything off my sheet when I run my code. I am having trouble understanding how to setup GAE to "listen" for changes an the sheets though. I have setup the GAE using:
https://cloud.google.com/appengine/docs/standard/python3/quickstart
But not sure how to integrate this using my sheets. Any help would be great!
What you want is doable but not in the same way you described. GAE cannot listen to Google Sheets. The usually interaction is with the Google Sheets API, which will require you firing off API calls to check for a certain sheet/cell for updates.
Since you are looking for a "push" solution, you will need to do it from Google Sheets' end. You need Google Sheets to fire off a request to your GAE and then you can process the information. I would suggest you code your GAE handler to process GET requests and then have your Google Sheets fire off a script to set a request to your GAE URL. You will set the script to trigger whenever the desired update on your sheet is performed.
What is the easiest way to run a python script from google sheets, or alternatively execute the python script when the google sheets opens?
I'm assuming you have some python asset that you would like to use to modify data on Google Sheets. If that's the case, then I think your best option is to use Google APIs to access Google Sheets from python. You can use any of the following two tutorials by Twilio to achieve that.
If you want to add the python asset into Google sheets (Ex. as a custom function), then it will be much easier to rewrite it in JS.
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
Im looking to write a new application in ruby/python which uses a feed from bloomberg and am stuck trying to find any documentation for using (or even setting up) Bloomberg Server API with either of these languages.
Does anyone have any good links to tutorials for this or maybe some boilerplate code to get set up? Or is it best to just stick to the three main supported languages?
The Bloomberg Open API (BLPAPI) v3.5 release now includes a native Python SDK.
http://www.openbloomberg.com/2012/11/21/open-api-blpapi-v3-5-x-released/
Did you check out some questions at SO on this. It might help you
Bloomberg API request timing out
Asynchronous data through Bloomberg's new data API (COM v3) with Python?
Resolver is an spreadsheet implementation in IronPython and has a very good integration for Bloomberg API
http://www.resolversystems.com/documentation/apidocs/MarketData_Bloomberg.html
Here is a simple Client access API which I wrote with the help of the mentioned links as well as some others. Not everything is implemented but it is a good start.
https://github.com/bpsmith/pybbg