Consider a Google Spreadsheet. Each row contains some measurement data from a given patient.
I wrote a Google Script function which iterates through the selected rows and exports each patient's data into a separate PDF file.
function Export() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("master-lab");
var range = sheet.getActiveRange();
var row0 = range.getRow();
var row1 = row0 + range.getNumRows();
for (i = row0; i < row1; ++i) {
ExportRow(i);
}
}
This code does not work if the user selects a non-contiguous array of rows, like in the following figure:
Is it there a way/workaround to iterate through non-contiguous ranges in Google Sheet?