So this is most likely the simplest question but I am just getting to learn this myself. Sorry for the silly question.
I have a huge Google Spreadsheet (2700+ rows) I need to loop and automate the move of data from one cell (dataA) to another (in front of the next row of data starting with dataB), then remove the 3 rows above the data row and move to the next record (block of 4 rows). Before I do anything I have to make room by inserting a column.
I have created a function that inserts the column, copies the first data cell (now B2) to its new destination (A4) and then deletes the useless three rows above the destination correctly. Because this is relative and iterative, I do not know how to adapt this part with a loop that will go through the rest of the entire sheet.
How do I create a loop that moves through each block of 4 rows, performs the actions mentioned, then moves on to the next block of 4 rows leaving each completed row one after another at the top?
This is an example of the starting data structure:
starting data structure - one record of many
function moveValuesOnly() {
var ss = SpreadsheetApp.getActiveSpreadsheet ();
var sheet = ss.getSheets()[0];
// This inserts a column in the first column position
sheet.insertColumnBefore(1);
var start = ss.getRange("B2");
var source = ss.getRange("B2");
source.copyTo (ss.getRange ("A4"), {contentsOnly: true});
source.clear ();
sheet.deleteRows(1, 3);
}