I get a list of employees from a third party. Some employees have more than one pay stub per month. So one column of the list is the employee ID and the second is the "sub-id."
Here is an example of a list of employees and IDs:
I want to run a function in Apps Script that copies the value of the employee ID and pastes it on the blank cells (so then I can do some calculations).
I've created a loop for the "Legajo" array but when I get to the if statement I don't know how to get the previous value and set it to the blank item.
function fillFile() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("matriz");
var numLegajos = sheet.getRange(3, 1, sheet.getLastRow() - 3).getValues();
numLegajos.forEach(function(legajo,i) {
if (legajo == "") {
legajo = ?? // this is where I don't know what to do to get the previous value and set it to the blank item
}
Logger.log(legajo);
});
}