Google Spreadsheets Scripting Server Error - google-apps-script

I have some spreadsheets that use the scripting feature to move, process, and create data in Google Spreadsheets, but recently, when I try to check the Script Manager or Script Editor on one of these, I get a server error. I also have some code that makes them autoload into a menu option upon opening the spreadsheet, but that of course doesn't work either because the scripts are unavailable as a whole.
It's been this way for at least a week with no change, and I don't really have any idea how to fix it. The scripts are pretty vital and lengthy, so I don't really want to make them again...
Any ideas?

Related

How to run my colab notebook periodically

I've written a script in Google Colab that performs some queries via API to a server where I host some information, let's say weather data from several weather stations we own, that data is downloaded in a JSON format then I save those files in my Google Drive as I'll use them later in the same script to generate some condensed tables by country and by month, those summary files are also stored in my Google Drive account. After that, I send the summary files via email to some people.
I need to run this script every other day and, well, it is no big deal to do that, but I'd like to make it happen without human intervention, mainly because of scalability. One of the main points is that some libraries are not easy to install locally and it is way easier to make it work in Colab, that's why I don't use some solutions like crontab or windows scheduler to perform this, and I need to make the Colab notebook to run periodically.
I've tried solutions like PythonAnywhere, but I've spent too much time trying to modify the script to work with PyDrive and, so far, haven't achieved it. I've also tried to run it using GCP but haven't found how to access my Google Drive files yet using Google Cloud Functions. I've been also working on building an image using Docker and if I deploy it to someone else, it'll be working, but the idea is to make the running schedulable not only deployable. I've also read the Colabctl option but haven't been able to make it run yet.
Please, I'm open to receiving any suggestions in order to achieve my goal.
Thank you,
Billy.
there is a paid scheduler https://cloud.google.com/scheduler
or you can use https://github.com/TensorTom/colabctl with your own cron

Running python script on database file located in google drive

I have a database file which is located on my own google drive (private) and it's updated on a daily basis.
I wrote a python script in order to track the data from the database file, however I need to download the DB file to my pc, and then running my script locally, every single day.
I am wondering if there are any better options, so I wouldn't have to download the DB file and move it manually.
From a slight searching on the web I found that there is no way to run the script in the google drive folder (obviously due to security issues), and using google cloud platform is not a real option since it's not a free service (and as I understood there is no free trial).
Anyways, any method that would make my life easier would be happily accepted.
Sorry
That's not possible AFAIK. At least in the way you have asked the question.
It may be that you are looking for a Database hosting service, which, as a rule, are not free. I remember seeing a SQL viewer around, I don't know if it is still available and I don't think it was accessible via a local Python script.
Google Cloud Platform, as other services, do however offer a free tier of services - though this depends on how much use you need to give it and also on your location. Though this can get quite involved quite quickly. There are also various options to choose from. For example Big Query may be something you are interested in.
A Possible Workaround
I assume that the reason you don't want to download it is because it is tedious, and not because your network connection or hard drive can't handle it, if so:
The simple workaround may just be to find a way to automatically download the database via the (Google Drive API)[https://developers.google.com/drive] with your Python Script, modify it, or read it, and then upload it again if you need to. This can be done all within one script using the API. So all you would need to do is run the Python script and you wouldn't need to manually download and move it into a folder. You would also not need to worry about running over the free tier and getting billed for it.
You could even use the Google Drive Desktop software to keep the database file synced locally. Since it is local, I doubt the software would be able to block a Python script on the file system.
If you don't even want to think about it, you could set up the Python script with a CRON job or a Scheduled task if you are on Windows.

how to query my database and have it be outputted on a Google Sheet so that someone can edit this data and then have it reflected back in MySQL?

I’d like to push some data from MySQL into Google Sheets. Once I’ve edited my data in Google Sheets, I’d like to push my edited data back into MySQL. Ideally, I’d even like to schedule it to update it every hour, so my data is always live and matches what's in my MySQL.
I’ve looked into Google Sheets Script and it seems that it enables you to type in a SQL query into a cell in Google Sheets and retrieve your queried data. However, the main issue, even though I find a proper way to export my data to sql, is that I have hundreds of tabs across multiple spreadsheets and I’d like to find a way to avoid to manually repeat this job for every tab.
Please have in mind that it is for someone on my team who can’t figure out querying with SQL, has a hard time navigating MySQL, and that I don’t want to train in SQL. I would just like this person to edit Google Sheets and these edits to be reflected back in MySQL, without this person ever having to go into my SQL database.
I think you can also use Google Apps Script to push back the data in mySQL. However, I don't know how scalable this solution would be.
Some tools exist to export data from SQL to Google sheets, like Zapier and add-ons such as Kloud and Blockspring. The thing with Blockspring is that it's targeted to people that are familiar with SQL queries. And none of those solutions allow you to push the edit data back to your database (at least, that I know of... would be very interested if it is otherwise).
So an option would be to use Actiondesk to sync your SQL database with your Google Sheets. You can schedule the synchronisation every hour (even every ten minutes actually), and it would be easy to add new sheets/tab anytime you need to (it's just a matter of few clicks).
Hope this helps!
Disclaimer: I am a back-end engineer at Actiondesk and personally implemented the Googlesheets integration, so I might be kind of biased (but at the same time, I might be the best person to answer your wildest questions on that regard so feel free to shoot them)!
It's possible to connect to MySQL with Apps Script, but you need to disable your firewall or whitelist all of Google's IP addresses (which are subject to change). As you mentioned you'll also need to set up the script for every Sheet or release the script as an add-on. You are also likely to run into difficulty writing back to the database (e.g. handling date formats).
SeekWell lets you automatically send data from SQL to Sheets and can also sync data from Sheets back to a database. It's built specifically to handle this use case, so it will get you up and running faster, but it's a commercial / paid product.
Disclaimer: I built this.

MySQL database efficiency for spreadsheet web app

Background: I am hoping to make a spreadsheet program a bit like Google Docs. I am currently in the planning phase and have realised that if one cell is changed then that could potentially affect 1,000+ other cells in the spreadsheet. I realise making 1,000+ database calls would be very slow and is thus inappropriate.
My question: how does one keep formula and value like information in a database and quickly make changes. The best approach I can think of is to download all 1,000+ cells as one big JSON object and then do the same for upload? I just can't imagine this is what Google does as the download and save speeds are so fast.
Promising pages have included:
http://www.trirand.com/blog/jqgrid/jqgrid.html
and
http://www.simple-groupware.de/cms/Spreadsheet/Home
but I have yet to be able to find a simple answer to my question.
In addition to these so far I have looked at:
Using formula-based data in Google Spreadsheet as back-end for Web App,
https://stackoverflow.com/questions/20961510/creating-a-basic-web-app-for-writing-reading-databases-google-spreadsheets
Spreadsheet like input facility for ASP MVC
http://www.reddit.com/r/SideProject/comments/1s466o/cellmaster_spreadsheet_formulas_that_build_web/
Open Source, web based spreadsheet app with formulas
Store spreadsheet kind of data in SQL Database
Database : best way to model a spreadsheet.
FYI: I am coding in the HTML5/LAMP stack but I am happy for solutions to come in any form as I can always "port" the ideas from anywhere. So far the most help I got was from:
http://en.wikipedia.org/wiki/Entity-Attribute-Value_model.
I am not so idealistic as to expect anyone to give me a concrete code implementation but I do believe this problem is not unique and that someone on stackoverflow is clever enough to have worked out an efficient method for storing and retrieving spreadsheet like information within a web app environment. Please just point me in the right direct and I will do the research to create my own solution.
Perhaps you can make use of Google Apps Script, in combination with ScriptDb.
References
Home page Google Apps Script Developers
Guide on ScriptDb
Edit 16-05-2014
Don't use the ScriptDB anymore !! It will be shut down as of Nov 20, 2014,
see sunset schedule: Apps Script Sunset Schedule

Google Script for scheduling pages on a Google Site

I am exploring the option of using Google Sites for our new intranet. We need to be able to schedule pages when they are created to automatically be deleted on a particular day.
I know this functionality is not native, and I would like to know whether or not it's possible to write a Google Script for a scheduling gadget in the editor view (as opposed to the live site).
And advice is very welcome. Thanks!
Jessica
If I was implementing this, I'd write a standalone script with two separate trigger functions, both of which run daily.
Script 1 would inventory the pages in the site. When new pages are
identified, their creation and projected deletion dates would be
recorded.
Script 2 would review the list of known pages, and delete any that
have reached their expiry date.
The reason for splitting the work up is two-fold: it simplifies the problem a bit to think about it this way, and it reduces the chance of experiencing a script time-out failure.
Unless there is a native way of doing this, I would create a WatiN interface to Google sites to create and delete pages