So I've be racking my brain about this one for a while now, not 100% sure why this code isn't working.
I got the code from a previous SO post, from there I changed the script to do what I needed.
function onOpen() {
// get active spreadsheet
var ss = SpreadsheetApp.getActiveSpreadsheet();
// create menu
var menu = [{name: "Evaluate Column J/Call Duration", functionName: "deleteRow"}];
// add to menu
ss.addMenu("Delete Calls Under 1 Minute", menu);
}
function deleteRow() {
// get active spreadsheet
var ss = SpreadsheetApp.getActiveSpreadsheet();
// get active/selected row
var activeRow = ss.getActiveRange().getRowIndex();
// get content column J
var columnJ = ss.getRange("J"+activeRow).getFontColor();
// evaluate whether cell has white text or not
if (columnJ == 'white' || columnJ == '#FFFFFF') {
ss.deleteRow(parseInt(activeRow));
}
}
Basically I have a spreadsheet that's exported from a super archaic call tracking software. Our main issue is that we need to take out any call that's under 1 minute and any duplicates. So, we added conditional formatting for both. This is for getting rid of any 1 minute calls, which in turn should delete the whole row.
Anyone have any idea about this? Thanks guys.