Código fuente en AppScript:
function expandStudentData() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet1 = ss.getSheetByName(‘Hoja 1’); var sheet2 = ss.getSheetByName(‘Hoja 2’); if (!sheet2) { sheet2 = ss.insertSheet(‘Hoja 2’); } else { sheet2.clear(); } var data = sheet1.getDataRange().getValues(); var header = data.shift(); // Get the header row var aulaVirtualIndex = header.indexOf(‘Aula Virtual’); if (aulaVirtualIndex === -1) { Browser.msgBox(‘Column «Aula Virtual» not found.’); return; } var newRows = [header]; data.forEach(function(row) { var aulaVirtualCell = row[aulaVirtualIndex]; if (aulaVirtualCell) { var courseCodes = aulaVirtualCell.split(‘|’).map(function(item) { return item.trim(); }); courseCodes.forEach(function(code) { var newRow = row.slice(); newRow[aulaVirtualIndex] = code; newRows.push(newRow); }); } else { newRows.push(row); } }); sheet2.getRange(1, 1, newRows.length, newRows[0].length).setValues(newRows);}