Sync Google Sheets with Web Page HTML - google-apps-script

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

Related

Securing A Google Sheet With A Custom Generated License Key

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.

Redirect to a new spreadsheet using Google app standalone script.

I have a standalone GAS which works with the Google Sheets. There is a case where a user could generate a new spreadsheet. I want to redirect the user automatically to the new spreadsheet as soon as it's been generated on the Google Drive.
For User Interface I use the SpreadsheetApp.getUi().
So far I wasn't able to find a working solution to do it automatically. The only thing I have managed to do is to present the user with a link to the new spreadsheet so he can click and go to it.
Are there any working solutions or workarounds to redirect the user automatically in such situation?
Will much appreciate for any comments!
NOTE: The script should be in the Add-ons menu in the Googe Sheets. It has a couple of different screens (currently, modals) which present and take info for the user. Taking that into account I believe I won't be able to implement my script as Web App, since I have seen a couple of suggestions how to do it using GAS Web Apps.

How to display number of rows in a Google worksheet in the Chrome Tab icon (email notification style)

I'm a novice so please explain it like I'm 5.
I would like to know when a new entry is made into a shared google worksheet.
I have the worksheet pinned in my Chrome session and thought the best way might be a count in the tab icon showing the row count - if this Changes I have a new entry.
The Worksheet has multiple tabs but I am only concerned with one of them, and entries will be made one line at a time.
Open to any other solutions that would alert myself and my team to new entries in the sheet.
Hope this is clear.
Thanks,
Ken.
If you're new to programming, creating an extension that tracks a Google sheet might be too advanced because of the OAuth2 API and other Google Data APIs that would be needed.
If you just want a notification, you can use this method for setting up email notifications from the sheet itself. I would then set up a filter in your email client to grab those notification emails and put them in a folder so you can see the count.
If you're okay with using third-party services, If This Then That (ifttt.com) is a great way to set up triggers for many different services, including Google Docs.

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.

Fetch and open a user specific url stored in a spreadsheet database using Google Apps Script in a Google Site

I've got an ambitious first Google Apps Script project for use in a Google site.
Using a spreadsheet database I have a list of Google users that each have a unique URL to a service at a non-Google website.
What I need to do is place a link in a Google Site that will
Get current user id based on logged in user
Interrogate spreadsheet database for the unique URL based on Google user
open the unique url in another tab/window
Any pointers or code snippets would be very much appreciated, especially around minimising user authorisation. As it is a Google Apps domain the script could be pre-authorised as a trusted script if that is even possible.
Thank you
I did write a site gadget that does exactly what you want, (except that users have to enter their name because the site is public and I wanted to avoid asking authorization), you'll find the code and explanations here, I'm not going to reproduce the whole code here but in short it allows to enter a name (even partially) and looks for any match in a spreadsheet list then shows a link to an individual url. It is also possible to see it working on the same page.
(see page bottom, it looks like this)
To answer your second point, there is no way to avoid the authorization process, the idea of 'trusted source in a domain' has already been mentioned in a few discussions with project members but for now it is not possible.