sites.google - anyway to harvest the data - google-apps-script

We have a shiny new Google Site that tracks the position of cyclists over a 1200km event.
The issue is that the content in the list needs to go into a mySQL database and I wondered if anyone had managed to loop through or transfer the content into a csv or similar from the list with test rider. I can see that working through json might be able to do this but I am concerned that this approach could fail.
I've worked a little in Google scripts for spreadsheets but not entirely sure where to start or even where to look. The site is at...
https://sites.google.com/site/audaxsm2013progress/sydney-canberra-day-1

Start with sitesApp in apps script and come back if your siteApp code is not working..
https://developers.google.com/apps-script/reference/sites/sites-app

Related

Google Forms response dashboard

When I searched through Stack Overflow (and the internet) before asking this question, I only found information on making a dashboard of a single form's data, which isn't what I'd like.
I work a lot with Google Forms and I'd love to have a way of knowing how many people have responded to my different active Google Forms. By default, one must open the forms individually to find out.
I'd appreciate any ideas, pointers or existing ressources you know that could help me out : I'd love to avoid builing something from scratch!
I know of no such existing service which does this. You can however do this in Apps Script with the Forms Service and the Charts Service.
Valuable pages include getting all the forms responses
and creating charts
Good luck!
I am dealing with multiple forms as well, and I realised that you could maneuver to the "Responses" page. Click on the settings button and select response destination to be an existing spreadsheet, and select a sheet to input your files too. This may be easier although less flexible than coding a script out. Cheers!

Unable to add new script in Adwords since new update

I've been a passive StackOverflow user for more than a decade now. I don't really think this is the place to ask this but Google Developers Help page referred me here.
Adwords has been updating to a beta version and I'm a heavy user of its Scripts console, but recently, when I want to ad a new script with the big red button, it starts loading and then this message displays: "There was a problem loading the script. Please try again later"
I've already tried with Chrome and Safari, a cookieless browser and with a different account and nothings seems to work. I also Google the error and there is nothing. I don't think I'm the only person experiencing this, do you have any solution?
I couldn't reproduce your problem and was able to create scripts—however, I've noticed quite a lot of bugs in the new web interface (to be fair, they say it's still in beta).
But as a workaround, just use the Return to previous AdWords link in the three dot option menu, which will take you back to the old interface. I could well imagine that you'll be able to add a new script there.

Google Drive for hosting JSON post 'host' discontinuation (August 2016)

While it appears that we will still be able to use google drive to host images for websites (when load speed is less of an issue than users being able to add things when they do not know any html). I have been using google apps scripts to generate JSON files that are then loaded to build webpages (This way I could have people add images to a folder, and lines on a spreadsheet and the page builds automatically). I noticed a couple of other people asking questions about this, so it is not only going to effect me. However with Google ending their 'host' feature in August, has anyone come up with a solution other than just make a small server that grabs the JSON file occasionally and hosts it in a way that allows cross domain access?
Well I found a work around inside google apps script for anyone interested. There is one large problem with it. It does not work on any safari browsers due to a known, but triaged bug. (https://code.google.com/p/google-apps-script-issues/issues/detail?id=3226) This is something I should have thought of before, as I have used it as a trick in the past:
function doGet() {
var myFile = DriveApp.getFileById('<FILE_ID>');
var str = myFile.getBlob().getDataAsString();
return ContentService.createTextOutput(str).setMimeType(ContentService.MimeType.JSON);
}
Once you have your id set up go to Publish->Deploy as Web App, set things to Execute as me, and anyone even anonymous can access. The URL https://script.google.com/macros/s//exec will allow cross domain grabs at this point.
This, I believe, will have a quota that could in theory be overwhelmed, but you can always choose to pay for more access. In my case I will just add direct access to the JSON generated by the original script so I will not hit google drive quotas, but this should work fine for any reasonably small project that does not need Safari access...

Transform Old Google Spreadsheet Code

I used this code to insert documents directly into a Google spreadsheet without having to upload files and then create hyperlinks. However, as google moved to the new spreadsheet...
Warning: The UI service was deprecated on December 11, 2014. To create user interfaces, use the HTML service instead.
So know I need help fixing lines like; var app = UiApp.getActiveApplication();
If someone could clarify the different types of programming direction you could take this project from, that would also be very helpful, I am not really sure if I need to work with Javascript or HTML now.
The answer to your question will depend in large part on how you are using UIApp. In most cases it's not as simple as changing a few lines of code but more of a script redesign.
If you are using it to create a custom user interface, your path forward would be to rebuild your interface as HTML/Javascript and serve it to the user with HTMLService. The service is overall much more powerful/flexible and provides a better end-user experience but it means rewriting how your script works. If you want to take a look at a helpful example on how the HTML Service works take a look at the HTML Service Guide or this quick-start example of an add on.
You can still link this html interface with your script using the google.script.run service but you will need to redesign your code/application to work with the new input methods. The good news is although UI service will sunset on June 30, 2015, "Service will no longer appear in autocomplete, although existing scripts should still function."
It's worth considering alternate ways to accomplish the same goal. The best way to do that is to start by asking "What is the intended use of this script? What problem does it solve?" There may be a better way to accomplish that task which may not even involve updating the script.
This is not related to the new spreadsheet version, the message you get is because UiApp has recently been deprecated.
A Google search would have shown you a few tracks to find your way.
One of the best I found is this one from Sandy Good : Google apps script UI services to HTML services
It shows a typical example of conversion to HTMLService.

Calling a Google Drive SDK from Google App Script application

i have been going around in circles here and have totally confused myself. I need some help.
I am (trying to) writing an application for a client that in concept is simple. he want a google write document with a button. the google drive account has several folders, each shared with several people. when he drops a new file in one of the folders, he wants to be able to open this write file, this file is the template for his email. he clicks the button, the system calls the changes service in the Google Drive SDK https://developers.google.com/drive/manage-changes, gets the list of files that have been added since the last time it was checked, then pull the list of people that the file has been shared with, and use the write file as a template to send that list of people an email saying their file is ready.
SO, easy enough, right?
I started by looking at the built in functions in the Google App Script API. I found this method, https://developers.google.com/apps-script/class_docslist#find in the DocsList class. problem is the description for the query simply says "the query string". So at first i tried the Drive SDK query parameters, which are
var files = DocsList.find("modifiedDate > 2012-12-20T12:00:00-08:00.");
it didn't work. that leads me to believe it is a simple full text search on the content. Thats not good enough.
That lead me into trying to call a Drive SDK method from within an App Script application. Great, we need an OLap 2 authentication. easy enough. found the objects in the script reference and hit my wall.
Client ID and Client Secret.
you see, when i create what this really is, a service account, the olap control in apps script doesn't know how to handle the encrypted json and pass it back and forth. Then when i tried to create and use an installed applications key, i get authentication errors because the controls again, don't know what to do with the workflow. and finally, when i try to create a web app key, i can't because i don't have the site host name or redirect URI. And i can't use the application key ability because since im working with files OLap 2 is required.
i used the anonymous olap for a while, but hit the limit of anonymous calls per day in the effort of trying to figure out the code a bit, thats not going to work because the guy is going to be pushing this button constantly thru the day.
i have been pounding my head on the desk over this for 5 hours now. i need some help here, can anyone give me a direction to go?
PS, yes, i know i can use the database controls and load the entire list of files into memory and compare it to the list of files in the database. problem being, we are talking tens of thousands of files. bad idea.
I wouldn't use DocsList anymore - DriveApp is supposed to be a more reliable replacement. Some of the commands have changed, so instead of find, use searchFiles. This should work more effectively (they even use a query like yours as an example).