Duplicate Spreadsheet with Google Apps Script triggers and permissions - spreadsheet

I have a google spreadsheet with an associated script and two manually triggers, furthermore protected cells, etc. It is the model of the teacher's gradebook that we want to have in my school. The problem comes when I want to create 50 copies, one for each teacher, where all of them have to have the script, the triggers, protected cells, etc. I've gotten everything except the manual triggers. What I can do? What solution can there be? Create it as a plugin? You can make a Chrome add-on that creates that Spreadsheet for you with everything you need (triggers, script, protected cells, formulas ...)
Help!
Thanks.

Related

Logging When Files Are Saved, Modified or Deleted Using VBA

I work with VBA in MS Access databases. I'd like to be able to log when files are saved, modified or deleted without having to update the existing code to do the logging when the pertinent events take place. I want the time, location and the name of the file.
I found a good example here: when file modified
However, it only allows for monitoring a particular location (path). I want to be able to log regardless of where the save, modify or delete takes place. I'm only allowed to program in the MS Office environment in this situation. It seems as though using the Windows API is going to be how this task will be achieved. However, I don't have much experience working with the API. Is there an easier way to achieve what I want that doesn't involve using the API?
Have you worked with After_Updates or After_Insert macros? Also, is your application split? Meaning there's a front-end and a back-end of the database. You can create a separate table that mirrors that table that you need to track changes for. Every time a table is updates, run a macro that inserts a row to that table.
I'm assuming you're saving files to the database. If that's the case, add a after_update or after_insert macro that can keep track of when then files are being modified or added to the table.

Password Protect ALL Excel Macro Creation and Use

I have a spreadsheet that I have password protected from allowing users to edit.
I would also like to password protect ANY and ALL actions related to Macros within this spreadsheet. I don't want anyone to be able to create a new macro in this sheet, run an old macro in this sheet, or even run a macro stored in another place on the computer.
Is this possible?
This is not possible in excel. There may be some system adminy thing you can do with Group Policies to force macro security, but that would affect all excel spreadsheets for that user, and not just the specific one you want. The whole idea is Excel is a document, not an application. Documents by design are reproduced and shared, and what the end user does with it is his/her perogative.

MS-Project: GUID preservation when moving task between master/sub-projects and/or assistance with macro solution

A. I would like to know if there is any way to move a task between projects and preserve the GUID?
B. If this is not possible, then If someone could help me with a macro that would facilitate this.
I think clarification on this issue would help the community in general as I don't think I am the only one who has had this issue.
A. When trying to move a task from either a master project to a sub-project or vice versa gives the following error:
You cannot move a task or resource from one file into another.
Try copying the task or resource and then pasting it into the other project.
I realise that this is probably because the task is considered a unique item to that schedule. After doing high level planning, I like to split logical sub-projects out, but work may have already commenced and I use the GUID downstream so I need it preserved.
B. I am not adverse to a macro task moving solution and I think the pseudo code would be something like this:
1) User selects tasks to move
2) User Clicks Button
a. Macro copies GUID and resources into a spare text fields
b. Macro cuts the selected tasks out
3) User selects where tasks needs to be pasted
a. Macro prompts as to where tasks should be moved to OR
b. User selects row where tasks should be inserted and clicks another button which initiates the pasting component of macro / second pasting macro
4) Macro pastes in tasks
5) Macro updates newly generated GUID with copied GUID and also the resources
After having a look through Project 2013 SDK, I cannot see how to set GUID.
Plus I am a bit rusty in the VBA department.
Any help would be appreciated.
Cross Posted on: Office Dev Forums - Project forums > Project Customization and Programming
Thanks.
A) MS Project can't move a task from one project to another. Even drag+drop will just copy it. If you use cut+paste, the old one will be gone at least. But, in any case, the new task will have a new GUID.
B) A task GUID cannot be modified, neither manually in MS Project nor via a VBA macro. I.e., for your approach, you should create some kind of own unique code that the people can use to reference or to track the tasks, e.g. a WBS code or just an Outline Code.
Note: Copying a project will renew all GUIDs as well. But, copying a project keeps the Unique IDs. Perhaps this is a way for you: First creating one file, and later splitting it by copying the file and then removing the obsolete tasks...
Regards, KAwi42

Interactive editable spreadsheet in Google Docs

I have created a spreadsheet in google docs. The spreadsheet takes some input, calculates some results, and displays the results numerically but also as a graph.
I would like to publish this spreadsheet, so that anyone can input and get the results and the graphs. I tried the Publish to the Web option (from File Menu), but the spreadsheet becomes static (no calculations possible on new values)
I tried the Share option. However when choose anyone can view the spreadsheet is not interactive. When i choose the anyone can edit option the file is usable, but my concern is that if I publish this on the internet and 2 users want to calculate simultaneously based on different values it will mix things up.
Is there anyway to accomplish what I require without setting up a website or programming in Javascript? I do not need to protect any of the calculation routines, I only require that the spreadsheet starts everytime with the default settings, the edits are not saved and the spreadsheet is interactive.
Seems like you may want to publish your Google Sheet as a template. Doing so will let strangers "deploy" a copy of your spreadsheet, for their own use (and without conflicting with other web users).
Google Docs template gallery
Instructions for submitting a template
Caveat: Until Google adds support for publishing "new" Google Sheets as templates, you'll likely want to submit a spreadsheet in the "old" format.
I might suggest using Protected Ranges.
https://drive.googleblog.com/2012/08/lock-down-cells-with-protected-ranges.html
Basically locked cells and you should be the only one able to manipulate the locked cells to you can freely set the page to be editable.
You can also specify the Range of cells that you wish to use when embedding. (See the publish options).
These two methods should help you with your project.

Google app script: getting data from spreadsheets without having viewing rights (not installable trigger)

The problem is that I have various spreadsheets (a) for which only one person has viewing and editing permissions, still other persons need some data from those spreadsheets (a) for their spreadsheets (b), they also need to be able to get an updated version of the data from the spreadsheets (a)
I created now a workaround using installable triggers with an on edit function (they have to change a specific field in the spreadsheet) to update the data, but the persons want to have a button/drawing which they can click or a menu entry to get the updated data from the spreadsheets (a).
From my perspective to combine an installable trigger with a button/drawing/menu entry is a dead end. Therefore my question is, if there is any other possibility to grant access to data from spreadsheets without giving viewing or editing rights to the documents where the data comes from...
Would be great if anybody would have an idea, thanks in advance
There are some limits on the Triggers that are used in a spreadsheet that you are going to run into. Check out this for details. Essentially, and onEdit trigger cannot access/modify another spreadsheet as They cannot access any services that require authentication as that user.
To update another spreadsheet outside of the current spreadsheet, I've simply installed a function and a menu item to trigger it. (Is this the dead end you speak of?) It does depend on the user to update the group, but that has been a benefit for my secure data as it requires the knowledge of the key holder to allow others the information. This is A to B, which is possible but B has to have edit access to A's spreadsheet.
No, B cannot get information from A unless they have access to it, as least as viewer. You cannot grant viewing privileges to individual cells, which is essentially what you want to do.
Without that ability, the solution is more in structuring the flow of the data. In one senerio where a user proved they can't be trusted to update the team regularly, I've create myself as 0. I have permissions to A and B. I run the function from 0 to access A and to update B, which also sends them an email, so all know when the last update has happened. Why don't I just use A spreadsheet to run the function, because from 0 I can access it and write it to B without ever seeing the data. It's a veil of ignorance. I never actually open A and 0 remains empty.
Best I could do.
I'm facing a similar problem.
I think that i found a workaround but no guarantee.
I used the importrange function which i intend to control via script.
I have tried the flush function and found it is a good trigger to force the importrange to work, which I added to a Menu (just in case).
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [];
menuEntries.push({name: "Refresh", functionName: "SheetFlush"});
ss.addMenu("Menu", menuEntries);
}
function SheetFlush() {
SpreadsheetApp.flush();
}
Now, as i don't want the B user to know the A SS unique address.
(when looking to the importrange function)
I am protecting and hiding the sheet with the importrange function in the B SS. And Im using an extra internal refernce in B SS for the hidden sheet.
I might have an answer for your anomaly.
My application client are people from my googleapp workgroup, they don't have permission
to view the files, but they are not a complete strangers.
I think that the following might work.
A file is the muster file with the code.
B file has importrange() function from A with a sharing permission.
And C file has importrange() from B with a sharing permmsion of B file.
the small twist is that B file has a linked sheet which is hide and protected.
I have check this, and if you are not the owner you will be able to unhide it.
In practice, my filling is that you can pull a similar trick with 2 SpreadSheets,
the third one is for extra safety.