1

I'm trying to make a very basic load schedule for work. We don't know ahead of time how many loads we'll be adding on a given day, but I'm trying to add a formula or script that will add a blank row between the sorted dates (i.e., all the loads for 11/20 will be listed, and then there will be a blank row). It's purely aesthetic, I just don't want this thing to be miserable to look at. Is there a simple way to accomplish this?

0
2

A couple of assumptions: 1) You use the first column for the date. 2) The first row is reserved for headers. You could achieve this with the following script:

function myFunction() {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = ss.getSheetByName("Sheet1");
    var i = sheet.getLastRow() - 1;
    var baseRow = 0
    while(i > baseRow){
        if(values[i][0]!=values[i-1][0]){
            sheet.insertRowsAfter(i,1);
        }
        i--;
    }
}

If you have a different sheet, change the name of the Sheet. If the chunk of rows are not starting from 1, change the baseRow value.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.