Reputation: 1
I have been working on providing an google sheets interface for non technical members in my team, where they can see a sheet of info on some members, and one of those fields is a link to accessing that resource on an internal portal. The sheet looks as shown in the image attached. This is an example sheet of the same type
This sheet will be accessible to these non technical team, who are going to have a look at this sheet, and if they want to work on a certain case, they will click on the link. What I want to ensure is that, when they get redirected to this url, I want to ensure that that particular row gets deleted from the sheet.
My initial problem is that I dont know what trigger should be used for making such a program. The one that seems most likely is a doGet(event)
found here
The second one is how to do i catch an event like this and associate it to a particular cell.
A secondary solution could be that of an onClick(event)
which would really make things simpler here, but that is not a "simple Trigger"
Note:- The good thing is that each resource is going to be unique
I could really use some ideas, i have drafted a little bit of a pseudo code here for the same, but it seems very hacks, and not computationally feasible:-
function doGet(event){
// code to delete a certain row when they visit the portal
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();
if (s.getName = "clicker_checker" && check which url redirected){
check which row and cell matches with the redirections url, and delete that.
}
}
Upvotes: 0
Views: 1010
Reputation: 6052
Since you are using a spreadsheet, the most suitable trigger for you would be an onSelectionChange
one.
This trigger will allow you to detect when a selection has been made in this spreadsheet- more particularly in the cell wanted.
Therefore, you can use a script similar to this:
function onSelectionChange(e) {
var range = e.range;
var sheet = range.getSheet();
var col = range.getColumn(); //if needed
var row = range.getRow(); //if needed
if (sheet.getName() = "clickeer_checker" && other_condition) {
// instructions here
}
}
Upvotes: 1