Google Script for scheduling pages on a Google Site - google-apps-script

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

Related

AppScript. Will linked GCP project affect quota?

I'm confused with one moment regarding GCP. So, i have different AppScript projects on different google accounts and i want to link them to single GCP project (on organization level) to be able to see logs in single place (followed this description). Everything work fine, but i don't understand now if it will affect quota somehow. From my understanding quota described here is per user, but i just worry that i missed something and because of the linked GCP project quota will be splitted between all appscript project.
I would appreciate any help and advice related to this question)
I don't think there's any limit to read/write operations for sheets using apps script, there's nothing about it in quotas and it doesn't make much sense.
There are quotas if you use Sheets Api via http
https://developers.google.com/sheets/api/limits
but that's entirely other story, and you only need this to access sheets from other environments(nodejs,php,python etc)
If you're using apps script I believe you're only limited by script runtime and total trigger runtime, which are counted per-script.

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.

Can i build a Master - Detail webpage in Google Apps Script?

I have a complete application in MS ACCESS which I am planning to re-do as a web application , (but searching for the right platform).
Google Apps Script has several advantages, however I need to confirm if it allows building a full-blown web app.
For example,
Can i add a login security page when user first opens the web page ?
Can i building a Master - Detail web page using Google Apps ?
_
Finally, coming from a MS ACCESS background, which would be most suitable choice of database to migrate to so things will work with Google Apps Script ?
Can i add a login security page when user first opens the web page?
Yes, you can. You'd have to get the credentials from somewhere and, unless they come from LDAP which I'm pretty sure you can't connect to, you will be able to handle them
Can i building a Master - Detail web page using Google Apps ?
Not sure what that is, but if you mean a complex HTML page then yes, you can.
Finally, coming from a MS ACCESS background, which would be most suitable choice of database to migrate to so things will work with Google Apps Script ?
This depends on how many queries you have to make, and how quickly you want them handled.
If it's small, you can use SpreadsheetApp itself.
If it's bigger, you can use BigQuery, JDBC, or something else.
And if it's even bigger, you will probably want to dive into Python, PHP, Java, or some other backend programming language.
Exporting tables from MS ACCESS and importing them into another DB software shouldn't be too much of a problem.
Lastly, who am I to answer this specific question? I come from a MS Access background myself, migrated over to Google Apps Script back when they had the UiApp and ScriptDb APIs, had a little bit of fun with HtmlService and I soon realized that for serious stuff, I need to have my own server, due to high latency between request/responses - so I started learning Python + Django.
These, in my opinion, are your options.

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 Spreadsheets Scripting Server Error

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?