Google Forms - Delete a single response - forms

I use a Google Form to capture membership details of an amateur organisation. When someone leaves, we mark them as LEFT on the form. However, under the new European GDPR legislation, we are required to physically delete details of any member who has left the group. In the latest version, you can delete a single entry by editing the Form and clicking on Responses ---> Individual ---> Delete but when there are a lot of entries, this is unspeakably tedious as you have to scroll through the entire response list to find the ones to be deleted. Is there a script function which will allow me to do this programmatically ?

Related

PowerApps- how to create a form where users can edit or delete rows that have been submitted

What I have:
As of now, I have created a Form (editable) where the user can enter their Name, Number, and Birthday, then hit the submit button, and that data is then entered into a Data Table. This information is also stored into Google Sheets for which I have created a flow. (when the user hits "submit", trigger the data to be updated into the google sheet).
What I need:
I would like users to be able to mess with the submitted data in the app itself (add a row, delete a row when you click on it, edit the row's info, etc), so essentially my powerapp is a nice front end for the Google Sheet. Is it possible to mess with the data once it is entered into the data table?
Any help how to do this would be appreciated.
I believe you started building Canvas app from scratch, so the screen has list below and "Add screen" on top. This way you have to introduce the Edit screen/operation & save changes using PATCH command.
There is another way: Create an app automatically from your data in PowerApps. This will give you the Browse Screen, Detail Screen & Edit Screen (aka New record screen) by default with all the Create, Read, Update, Delete (CRUD) operations right away using the Connection - Google sheet in your case.
Video tutorial for assistance

Is there a way to create an output form based on Google Sheets data?

What I want to make
Is this possible?
I'd like to create an output form that reads data from a Google Sheets spreadsheet. In the form, users would enter a few values (entering their name and some ID number, for example) and view the corresponding information in the connected spreadsheet but not any other information in the sheet. Something like an output form in Microsoft Access. I'm hoping there's a way to accomplish this in Google Sheets using existing tools and maybe some scripting.
More generally, though, any way to create this type of 'limited visibility' on a per-user basis for Google Sheets data would be useful. (The 'protect sheet' function in the menu doesn't accomplish this; see below.)
For reference, my specific use case at the moment is as a teacher and wanting a way for students to see specific information related to them from my student information spreadsheet but while not revealing other students' information. I would have a simple form where they enter a name and maybe some personalized code that I give them so they can see their attendance record or something else. For my purposes, I don't need the form to be extremely secure as none of the information is all that sensitive (although more secure is better), but I don't want to be just putting all the information there in front of them by giving them access to the entire sheet.
What I've tried so far
I made a new spreadsheet file with two sheets; one sheet was visible to function as a form, and the second sheet was not visible (which I accomplished via the 'protect' menu option). I used importrange() to read in the relevant data from my primary spreadsheet to the new spreadsheet's non-visible sheet. On the visible sheet, students entered their name from a drop-down and entered their student ID as validation. If the student's name and ID matched, the first sheet did a vlookup() to read in information from the protected sheet and some information from their student record.
Here's what I made, in case my description doesn't make sense: https://drive.google.com/open?id=1cHO2jzMh1mkXvlLh-M4eYqN7v11t95-GnfWqL5IwQ14&authuser=0
This had two problems, one small and one big.
The small problem was that every student could see the "form" sheet at the same time. If two students opened the spreadsheet at the same time they would see any information that the other student had entered. I handled this by writing a simple script to automatically reset the "form's" input cells after 20 seconds. Also, any time the form was opened by a new person, the "form's" output cells were erased. So, obviously not a brilliant solution, but for my purposes, this was mostly good enough.
The big problem was that Google's own preview viewer (built into Google Drive and the like) ignores protected ranges and sheets and displays the entire contents a spreadsheet. (Normally, protected sheets are not visible at all and don't appear in the list of sheets at the bottom of the screen unless the viewer has access to them.)
In my case this meant included the protected one that shouldn't have been visible at all, rendered as if it were a print preview, meaning the students were actually able to view all of the other students' data in one big table.
Are you familiar with Web Apps?
An Apps Script Web App allows you among others to output selected Google Document contents into a browser.
Hereby, you can use the method Session.getActiveUser() to obtain the email of the user and dynamically adjust the data the user is going to obtain in function of his email (BTW, you can also use Session.getActiveUser() in the spreadsheet, to detect the user automatically instead of asking him for his name).
Simple example workflow:
Replace in column A student names through student emails (the Gmail addresses with which the users authenticate their sessions and access Google Sheets)
Bind to the spreadsheet a script with a content similar to the following:
function doGet(){
var ss=SpreadsheetApp.getActive().getSheetByName('Data');
var range=ss.getDataRange();
var values=range.getValues();
var user=Session.getActiveUser();
var output="";
for(var i=1;i<ss.getLastRow();i++){
if(values[i][0]==user){
for(var j=1;j<ss.getLastColumn();j++){
output+=(values[i][j])+" ";
}
}
}
return ContentService.createTextOutput(JSON.stringify(output));
}
Make sure that you have a doGet() function and a return statement.
After running the script once manually to trigger authorization flow, deploy it as a Web App - executing it as User accessing the web app and giving access to Anyone (unless desired otherwise).
Copy the URL of your WebApp and forward it to your student.
When the student open the URL in their browser - they will obtain their results - provided their email is listed in the sheet.
Please note that the code provided is a simple sample, that retrieves
all data and outputs it as a string. Feel free to modify the script
e.g. retrieving only columns of interest and outputting the data as a
html table, rather than a simple string.

Delete all items with restful api

I want delete all items in restful api,I already searched but didn't find anything good
I can delete items with id parameter but I need to clear all of them
Are there anyway to delete all of the items, not deleting items with id one by one
Are there anyway to delete all of the items, not deleting items with id one by one
In HTTP, the semantics of a request apply only to the target-uri; so there isn't any way, for example, to craft a DELETE request that targets multiple resources.
But: there's no rule that each and every row in your database has to have its own dedicated resource, or that all changes to a given row in the database must pass through a single specific resource.
For instance, imagine a web page that lets you delete things. It might look like a bit list, with check boxes next to each item. You select the ones you want to get rid of, click the submit button, and a POST request arrives at the server, which looks at the contents of the request and makes the corresponding changes to the database. That is a perfectly normal REST pattern that we've been using on the web for 25 years.

Redirect in Sharepoint 2010 Event Receiver

I'm looking at some code which has broken the saving of changes of a List item in SP2010. In the constructor of the Event Receiver the HttpContext is being stored as a local variable then in the ItemUpdating at the end a query parameter containing the return url is retrieved and passed the SPUtility.Redirect(...). This has the effect of canceling any changes that were made in the edit form. So following so scenarios I've found online I'm storing the HttpContext as a static class object and redirecting in the ItemUpdated event and edits are now persisted followed by a redirect to where we are expecting.
I have a concern though with storing a specific user's HttpContext as a static on a class which will potentially be hijacked if another user does the same action between the time user 1 sets the context initially and prior to the redirect. User 2 will overwrite the context and there are potential issues.
The only other option I can think of as a quick way out would be to store a static Dictionary where the key is the user id then remove the entry just prior to redirecting so as to not leave stray HttpContext instances leaking.
So looking at the accepted solution from here the first response by servy42 states The fact that it works for a few trivial test cases at first doesn't make it a viable solution. but doesn't suggest a viable solution.
There's another option best approach may be changing Save Button in ribbon such that when clicked, a ECMA script first save your Item, then redirect to other page, or open other page in dialog. suggested further down but is that the only other way to go?
I'm fairly new to SP and just trying to navigate through the wealth of wrong ways of doing things with my limited knowledge, whilst unfortunately being stuck with SP2010.
Any thoughts on how to go about this?
============
Edit: Further info as requested
So there are two sites one say called A which will have a sub site called B. A has a List and adding an item to that list triggers event receivers which creates sub site B and other related stuff. If I modify the B "item" from the SharePoint list of Bs then I don't need to redirect and returning to the list is fine. If I'm looking and a neatly rendered Gantt chart on A listing the Bs the if I edit B after clicking Save we need to come back to A. If I'm on B there's an edit button as well so I want to return to B after editing and clicking save.
So we have the source= appended when we go to the edit screen. From some reading I've done it seems SharePoint will pick that up and redirect. One of the fields on the edit page is the relative url beneath the A site and if that changes then the redirect url will no longer be valid and throw a 404 so we replace the old B sub path with the newly entered value. But we then need code to redirect to the new location.
I am not quite sure whether i understand your requirements correctly. But i will give it a try. Just a quick summary of what i understood (correct me if i am wrong...):
You have a Root Web in a site collection with a list
Each entry in that list corresponds to a subsite which will be created on List Item creation (ER) below the Root Web as a subsite
List items can be edited from both the List in the root web as well as from the subsite it maps to
On editing from the subsite you want to return to the subsite after saving
My approach would be this:
Follow the steps described in this article SP Dialog and List Forms
Open a dialog on the subsite that links to the edit form of the root web.
After saving the user finds himself already where he should be
Hope this helps... Cheers!
Edit: Just read the requirement about changing of url. Create a custom Edit Form which you enhance with some js that passes values back to the origin site -> Parameters in dialogs. You may then react accordingly in the javascript callback and redirect to the new url.

Apply Customer Tags to Order Detail Tags

I have a shopify page where I need to track who makes a sale. I would like to set it up where a sales rep puts their name as a customer info tag; then whenever that customer places an order online that tag is moved automatically to the order details tag. How can this be done?
This is not posible "out of the way" right now, unless there's an app which does that (I don't know any doing this magic).
A workaround could be:
If you have customer accounts enabled on your Shopify store: click on Settings, then Checkout and radiobuton click either Accounts are required or Accounts are optional.
Now, you should be able to tag your "selected" customers with "sales_rep" tag. Then, you go to your customers tab and filter the customers tagged with "sales_rep" and export a list of them.
Once Shopify dashboard shows you this list, you export it to a csv file.
Once you have this file, you have a list of emails of your "sales_rep". Then you go to your orders tab and either export all orders or orders from a selected date to a csv file.
You make one Excel or Open Office Calc out of those 2 csv files. Each file should be one tab of the resulting file. Now you need to write a tiny Open Office Calc or Excel formula in order to only find the orders which where placed by the "sales_rep". Do the filtering using the email field.