I have this problem:
- A Google Form that saves data into one file (spreadsheet)
- Multiple users (admins) that access this file (all of them can see all rows)
- Let's say the first column is called Department, and there are rows like ("Department A", "User input related to department A"), ("Department B", "User input related to department B"), etc.
- So, for the moment, any admin can see all rows for all departments. (This is my problem.)
- I want the admin to see only the information related to a specific department.
Can you suggest me a solution?
I'm trying to find a way to send data from Google form to multiple spreadsheets (I mean multiple different files I can share later, one by one).
Or to create a script to copy from Google Sheets file to other files information for a single department.
And I'm trying to use only the script editors for sheets and forms, and I am very confused.
Update:
- I found how to add a script that runs on editing the spreadsheet. Also, I found how to move a row in a new tab in the same file.
In Tools - Script Editor:
function onEdit(event) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();
if(r.getValue() == "somevaluehere") {
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("NewSheet");
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).moveTo(target);
s.deleteRow(row);
}
}