Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9787

Google Script to only search specific worksheet name not whole spreadsheet

$
0
0

This current script works but searches column 14 in all sheets on the spreadsheet. I only want it to search column 14 on sheet name "Master Crime Spreadsheet".

Thanks in advance for your help

var POST_URL = "DISCORD WEBHOOK URL"function onEdit(event){  var sheet_name = event.range.getSheet().getName();  var rangeNotation = event.range.getA1Notation();  var oldValue = event.oldValue;  var value = event.value;  var items = [];  var column_id = 14  if (column_id < event.range.getColumn() || column_id > event.range.getLastColumn() ){      return;  }  if (value == undefined && oldValue == undefined){    if (rangeNotation.includes(':')){      reason = "Multiple Cells edited";    }    else{      reason = "Cell value deleted";    }  }  else{    if (oldValue == undefined){      oldValue = "Empty cell";    }    if (value == undefined){        value = "Empty cell";    }    reason = oldValue +" -> " + value  }  items.push({"name": "To process go to https://tinyurl.com/xxxxxxxxxxxx","value": "Click doc to go direct to CRIS form: "+ reason,"inline": false  });  var date = Utilities.formatDate(new Date(), SpreadsheetApp.getActive().getSpreadsheetTimeZone(), "EEE, d MMM yyyy HH:mm:ss Z")  var options = {"method": "post","headers": {"Content-Type": "application/json",        },"payload": JSON.stringify({"content": "<@&964625157878611998>,<@&964625199129563156>,<@&964625248911753306>","embeds": [{"title": "New CRIS Loaded, REACT WITH TICK ONCE PROCESSED","color": 33023,"fields": items,"footer": {"text": "Timestamp (UTC): "+date                }            }]        })    };    UrlFetchApp.fetch(POST_URL, options);}

Viewing all articles
Browse latest Browse all 9787

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>