Securing A Google Sheet With A Custom Generated License Key - html

I am trying to secure a heavily customized Google sheet so that it may be licensed out for personal or commercial use, and am looking to secure the sheet by generating and sending the user a license key that they may paste into the sheet to unlock it.
I have checked this answer below for how to create the dialog box/popup, but am not sure if this would sufficiently stop people from just closing it out/bypassing verification.
https://webapps.stackexchange.com/questions/80213/create-a-popup-in-google-spreadsheet
I'm also considering tying all of this into Firebase for ease of use.
Has anyone every done this before or know if Google sheets has this capability?
Thanks!

The method of creating a dialog box or pop-up won't work because the user who will get access to the sheet can just simply close it.
According to the Dialogs and Sidebars in G Suite Documents documentation:
An alert is a pre-built dialog box that opens inside a Google Docs, Sheets, Slides, or Forms editor. It displays a message and an "OK" button; a title and alternative buttons are optional. It is similar to calling window.alert() in client-side JavaScript within a web browser.
Therefore, what you are trying to do cannot be done.
By default, all the Spreadsheets you create can be viewed and edited only by yourself.
The only way to restrict or extend the access to a Spreadsheet is by using the sharing settings.
If you want to protect a certain range or sheet from editing, you can protect a sheet or a range. Please note that this still allows the viewing of the sheet or the range.

Related

Launching special links from a selected or clicked cell in google sheets

Google sheets restricts which link types can be launched (https://support.google.com/docs/answer/3093313?hl=en), but with google apps scripts I was hoping to build a workaround so that people can launch an internal app with relevant information (ie App:123132). onSelectionChange would seem to be an option (when the user selects the cell with the relevant link, open the app) but it's not an installable trigger, limiting what can be done (specifically, I can not launch a new page or try to redirect to a uri such as App:34234). The other triggers don't seem to provide the functionality to do this without polling, which doesn't seem to be the right way to do this. Is there any other way people are aware of to make this happen?
Without polling there isn't another way to make this happen. As you already mentioned there aren't simple/installable triggers able to open a link.
By using Google Apps Script one option is to create a web app to show the content of the "special link".
Another option is to use a dialog/sidebar to use client-side code to open the "special link"

Bypass verification for GAS bound to a Sheet?

Is it possible to bypass the verification process or at least the VERY SCARY "Go to (unsafe)" in tiny letters next to "BACK TO SAFETY"?
I sometimes have a shared Google Sheet that is meant to be used by a volunteer organization (think neighborhood HOA or PTA, etc) and I add Apps Script to add menus to assist with adding or editing information on that Sheet only. I don't request any user information and I'm not using the script to access the users Drive or Gmail or other sheets.
I haven't been able to find good documentation on this, but I can't tell if the Verification requirement stems from:
The fact that there is a script running at all
Some call I'm making to an API that is sensitive (and maybe I really am getting access that I don't realize?)
Use of HTML forms
If it's the 2nd that could mean some changes could render my scripts harmless - Fyi a possible culprit is the use of SpreadsheetApp. I use that to access .getActiveSheet(), .getActiveSpreadsheet(), .getUi().showModalDialog(), .Dimension.ROWS, .getActive().getSpreadsheetTimeZone(), .getUi()
.createMenu()

Sync Google Sheets with Web Page HTML

What is the easiest way I can sync a sync a google sheet with a web page form (see attached picture)? Ideally an example code or tutorial.
Here is what I want: I want users to access my web page so they can select their name from a drop-down menu and put it next to the item they wish. Then once they click submit, each person's name value will be transferred from the webpage and then recorded into the corresponding cell inside the google spreadsheet. Then when the next user comes to the site, the fields will auto-populate from the google sheet so he will see who has picked what and what choices are left.
Ideally I would just send the users directly to the google sheet to make their selections, however, they can't edit it on a mobile phone without d/l the app and a bunch of other bogus roadblocks. Google Forms also does not work for this for several reasons.
Some things to keep in mind:
- the spreadsheet is totally public and editable. So I'm hoping to avoid the need to set up an API
- no security or login necessary for the users (I am not worried about if someone changes someone else's name)
I have spent weeks trying to find how to do this but I'm just a construction worker I don't know technology
SYNCING HTML FORM WITH GOOGLE SHEET
From Tanaike,
If you can use the web page as Web Apps of Google, I think that it can achieve what
you want using Google Apps Script, and you can get and put the values
of Spreadsheet. In this case, the Spreadsheet is not required to be
published. The document of Web Apps is [can be found in comments].
– Tanaike 10/19/2018

google spreadsheet script html service for all

I wrote a google spreadsheet script incl. html service. Now I like to publish the html service as a survey. Everbody shall see it without registration at google but it should be not allowed to see the results of all participants.
Have you an idea how can I reach this?
I tryed a lot of publish options but I didn't reach my goal. Do you?
Right now, your Apps Script Project is probably bound to the spreadsheet. If the users who are submitting the form, never need to see the spreadsheet, then create an Apps Script file that is not bound to anything, it's "Stand Alone". Then do NOT share the spreadsheet. If you share the spreadsheet, then people who the file is shared with can VIEW the spreadsheet. It is possible to hide and protect sheets and ranges. And of course you can make settings for some users to be able to VIEW the spreadsheet, and others to EDIT.
If you share the spreadsheet file, then everyone it's shared with has VIEW permissions. You can't share a spreadsheet file and not give VIEW permissions. But, if you want some users to be able to see just some sheets in the spreadsheet, and not all the sheets, then you would need to write some code that ran when the Spreadsheet opened, and that code would be hiding and unhiding sheets depending on who opened the spreadsheet. Only users with EDIT permission can unhide a hidden sheet. So, that's an option. You can hide a sheet from anyone. But a user with EDIT permission can unhide the sheet. If you want to hide a sheet from someone with only VIEW permission, (They can't unhide it) then have code run onOpen() that checks the user, checks their permissions and either hides or unhides the sheet.
If the people submitting the form, never need to view the spreadsheet file, then don't even share the spreadsheet URL with those users. Just use the Stand Alone HTML Service as your "front end", "User Interface" with the users who never need to view the spreadsheet.
So, if the people who are using the HTML don't need to ever view the spreadsheet, then don't give those people the URL to the spreadsheet. Give them the URL to the published app. In that scenario, the users of the published app will never see the spreadsheet. The published app is essentially a website, with no real domain name.
The solution for you, depends on how simple or complicated the sharing, editing and viewing settings need to be.
When opening the script file, you need to use the Publish >> Deploy as web app option.
Then, choose the version you want to deploy as webapp or create a new one, set the app to execute as you, and add access to anyone (even anonymous). Like this:
The important thing is that the function that's called when someone access the URL that's shown for your web app, is a function called doGet(). So you must rename the function you use to display the UI and Form to doGet(). This function should return a valid HTML Output (normally using the HTMLService or the deprecated UiApp service).
So this:
Gets you this:

web app : sharing settings

I have an apps script, a web app (within google site, share option: "Who has access to the app:anyone within mydomain" when publishing it) who make a forms using code as :
var app = UiApp.createApplication();
var panel = app.createVerticalPanel();
.....
When user press submit button the data are saved in a spreadsheet.
I have to give full access to an user group on this spreadsheet in order to make the forms works.
the problem, is that i don't want user1 (belonging to the user group) see what user2(belonging to the user group) has save in this spreadsheet.
At the moment, i share the spreadsheet without notifications but users are style able to access the spreadsheet using "shared with me" button on the drive.
Question:
Is that possible to hide share (like $ share on windows)?
Is that possible to let the script special grant option to read/write the spreadsheet without sharing it with the user group on run time.
or how the actual google forms (the one provide by google drive, not mine) handle this problem ?
Google API is not activate in my domain, i have a google education license and i am the admin of this domain.
hope it's clear enough.^^
thanks for hwelp
If you use Google Forms, you do not need to share your spreadsheet at all. You can distribute the URL for the live form, and from there users can only enter form data. Forms are static, though - you can edit the questions easily, and create logical flows between pages of questions based on previous answers, but you cannot dynamically include data. You're also very limited in your options for layout. But aside from that, the ease of use and information security make them a good option.
With Legacy Forms, collected data is stored in a spreadsheet. Since the introduction of the new Forms, you need to first create your spreadsheet, then select Forms - Create Legacy Form to start. The "Summary of Responses" report reflects what is in the form table in the spreadsheet. Any changes you make to the sheet affect this, for example row deletion, addition, or information edits.
With the new Forms, introduced in February 2013, the collected data is attached to the Form, not a Spreadsheet. You can choose to have it copied to a spreadsheet, but since that is a copy, any edits you make to it will not be reflected in the "Summary of Responses". You can create a new Form from the "Create" dialog in Drive, or from within a spreadsheet.
Your spreadsheet must be shared as 'anyone with the link can EDIT', as long as you don't publish this link no one will be able to find it and it will not appear in their 'shared with me' category.
Your webapp however will allow each user to fill the spreadsheet with their date by using the form.
see this other post that shows a practical example.