I am trying to assign leads to Account executives by looping through the list of AE's and moving an "X" to the AE who should be assigned next. The way I determine if the lead should be assigned someone is if there is a blank next to the company name.
Essentially the logic should go, find blank, find AE name which is next to the X, use that name to fill in the blank, find next blank, and so on until there are no more blanks. I have written out pseudo but I am not familiar with Google App Scripts at all. Can someone help my figure out what code will work for the pseudo?
***
var STRINGX = 'X';
function main() {
Logger.log(getNextPerson())
var person = getNextPerson();
var leadRow = findNextOpenLead();
assignPersonToNextLead(person, leadRow);
moveXDown();
}
function getNextPerson() {
var sheet = SpreadsheetApp.getActiveSheet().getDataRange().getValues();
var startRow = 2;
var salesReps = sheet[1].splice(0, 1)
}
function moveXDown() {
// find column with x and save it as a variable
// delete x from that column
// add 1 to column we found
// put it in ^ that column
}
function assignPersonToNextLead(person, leadRow) {
// find row next to lead
// put person in the b column and row of lead
}
function findNextOpenLead() {
// go through column b until you find an open cell
// use that row in column d to find the lead
}
***
The A,B,C's are in place of the real AE's names