While creating a staff database using Fusion Tables and Google Apps Script, I am trying to leverage the existing Fusion Tables UI as much as possible. Cards have been very useful but I am looking for a way that I can programmatically change their layout.
For each entry in the database, a user can upload relevant documents and attach them to an entry. The files are stored in google drive and a link to that document is stored (as an html string) in one of the database fields. Here is a simple image of what that may look like and the layout code to make it.
The problem is that the uploadable files (and fields) are dynamic. The user can add or redefine those fields through my ui and I need the full list of available files on each card to adapt accordingly so I don't have to manually configure the layout each time. How can I create a list of links on the card?
Other background info:
The fusion table will be view only. I haven't figured out a way to validate data entry in the fusion table ui so data entry will be done programmatically and in a custom ui.
I understand that my current method is not very robust and I am very open to other ways of providing access to these files through the card. I've even toyed with the idea of having a general html field for each entry which is programmatically created to display what I want. I'm just hoping there's a better way.
P.S. I've been struggling with reputation limitations for posting links and images. If you think I'm reputable, please help me out.
The problem is that the uploadable files (and fields) are dynamic. The
user can add or redefine those fields through my ui and I need the
full list of available files on each card to adapt accordingly so I
don't have to manually configure the layout each time. How can I
create a list of links on the card?
I may not be exactly following, but it sounds like your app can change the schema for each user? That's what your sample info window HTML seems to show. But that would require a separate table for each app user. If that's not the case then I'm not clear how you are using the term "field".
In any case, the Fusion Tables API does allow you to change template contents, which may solve your problem: https://developers.google.com/fusiontables/docs/v1/reference/template
Related
I am looking to find out if it is POSSIBLE to restrict EDITORS from downloading, copying or printing a Google sheet or other documents in a Google Drive. We share sheets/documents with our customers so they can fill in the details. For that we need to make them EDITORS (so they can edit and even invite others to the party). I know that we can restrict COMMENTERS and VIEWERS from downloading, but in our case we need to prevent EDITORS.
We have a LOT of intellectual property in our sheets (custom formulas and approaches), and we would like to be able to prevent people from simply downloading it. As I understand it this SHOULD be possible using the Google Drive API, but I have not been able to figure out how to do it, yet. Looking at the API it obliquely says it MAY be possible, but it is not clear :-(
Direction, or sample code, would be VERY much appreciated.
TIA
It's not possible to restrict editors from downloading files. The documentation mentions that only commenters and viewers can be prevented from this. Then in the API docs concerning permissions and their definitions you will see that there's nothing controlling downloads either. This is just a UI change.
If you think about it, the reason is clear: Even if you manage to stop direct downloads, to anyone with at least read access to the file or API this is just a minor inconvenience. They can still read all the content and metadata from the API and replicate the file perfectly. Even viewers with copy disabled can still read the formulas from the formula bar. Sharing the Sheets file is inherently unsafe if you have confidential data in it, since a determined attacker can still get all your trade secrets easily. You're only supposed to share these files with trusted users.
My suggestion is to take a different approach. Do not share the Sheets file at all and use something else as intermediary to request data from your customers. For example:
Create a Google Form to save the responses to a Sheet. Your customers will only need to fill out the form and the sheet will be filled with data that you can handle on your side.
If you need the users to also view some information in the Sheet before filling out their info you can build an Apps Script Web App that displays only the plain data that you need to show them. With this you can hide the formulas and other sensitive information. Using templates and server functions you can allow the users to interface with the Sheet data similarly to how they do it now, but with a more restricted view. You could even allow them to edit only the data you want them to. This requires more work and is starting to delve into web development, but It's much easier than a fully fledged website since the hosting and interfacing with APIs is handled by Apps Script.
You could just create your own application and use the Sheets API to read and write data from the Sheet. This is pretty much the previous suggestion but much harder, though in the end it will give you more flexibility.
The bottom line is that sharing your Sheet in any way is akin to giving your users full database read or write access, and there's no single setting that can prevent that. Your best bet is to avoid sharing these files and use a different method to request user data.
I'm currently creating a Google Site for staff where I work. We would like each staff member to have their own page that only they can view with details such as rota's, shift itinerary etc. We would not like other members of staff be able to view this. The current idea I have for implementing this is to run a script that generates a page for each user with the custom permissions set so only editors and themselves can view it. However, although I am aware you can set site wide permissions through Google Scripts, I can not find a way to set page wide custom permissions programmatically.
Is anyone aware of a way I can do this or if there is an alternative way to achieve the same goal?
Many thanks
Check out the following link:
https://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=2934
And also check out the following link (check comment #15):
https://code.google.com/p/google-apps-script-issues/issues/detail?id=1021
(comment #15): A work around you can use is to add a group with the permissions you require and then from Apps Script you can programmatically add/remove people from the group.
If you want Google engineers to develop this functionality then vote for this issue on the above link.
Right now I enter view code (map & reduce) in the couchbase UI. This is very inconvenient, and I was wondering if there is a way to make couchbase scan the code from a folder?
This will allow me to put this code under version control, and allow me to create a script that copies code between environments.
I dont know of a 'native' way to store views in files, but you can add and remove views via REST. So you could implement a workaround.
Views REST API
I want to create an app that "types" into a text document in Drive. The goal is to have a document which is publicly viewable, if not editable, and a program which enters text into that document as though it were being typed by a person. If I use the following Drive API endpoint PUT https://www.googleapis.com/upload/drive/v2/files/fileId
will a viewer see the edits taking place a character at a time? (assuming I upload each version with one character difference). Or is there a function which would allow me to programmatically "type" each character?
My perusal of the Realtime API makes it look like this is what I want except that it involves setting up a separate page, where what I'm looking for is just the ability to write to a doc in Drive, in real time. Am I looking in the right place?
If you just want a background script that writes to a file, you probably don't need the realtime API. This is more designed for multiple users making changes at the same time.
However, it may be possible to accomplish what you want using the import/export functionality.
Use realtime.get to get the contents of the file as json. Then use realtime.update to post a modified version of the contents. This will cause the diff of the get and the update to be applied to the realtime model. Any active clients will see the changes come in as some new characters added to the document.
I have a question regarding Google Docs and content controls (if there are any?)
We have a system that lets users design a MS Word doc with content controls (rtf text, comboboxes etc) and assign an ID to the control so that our system can pull the ID and register the answer. The data is then saved in a database.
What is a content control?
So my question is, is there any way to acheive this with google docs? I've been looking around but were unable to find a satisfying answer.
I would like to present users with a document in google docs that they fill in and return to me.
It does not have to be controls, but maybe sections that I can identify and pull content from with googles API.
You have couple of options:
Use the Form option in Google Spreadsheet. Check their tutorial at: http://support.google.com/docs/bin/answer.py?hl=en&answer=87809. They have a nice set of controls (checkbox, multiple choice...). You are getting the benefits of automatic update of the forms into the spreadsheet; no need to create a database...
A bit more complex (but still simple) option is to use Google Apps Script to write a small application GUI that works with the spreadsheet. You get more control over the GUI and all the benefits of automatic data storage, triggering events on each form submission etc. Check out this advanced tutorial: http://code.google.com/googleapps/appsscript/articles/building-sites-app.html