I'm building out a scheduling assistant; the look is great, but it is very tedious to Merge & highlight each schedule block individually, so naturally I turned to Apps Script.
I'm entering different Names (text values) on the schedule that may or may not be different every time, but the good thing is that each block will always be 3 hours (or 6 total cells).
My goal is to use a "Transform" button to run a script that would take any cell that has a text value on the schedule, and merge & center that text value with the 5 cells below it.
Ideally, I would type in all of the text values at their start time, then click this button, and all would merge at once - thus creating a 3 hour block.
My plan is to use Conditional Formatting to highlight these blocks after.
My current script is below, but I'm getting an error in Line 5.
As I'm sure you can tell, I'm very new to this. Trying to run Macros & use information I've found online to piece something together. Would anyone be able to point me in the right direction here?
function Merge() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var s = ss.getSheetByName('Schedule'); var range = s.getDataRange() var values = range.getValues(); for( var row = values.length -1; row >= 0; --row ) if (values[row][1],[2],[3],[4],[5],[6],[7] <= '') s.getRange(row+5,1,1,1).mergeVertically();}I've also linked a sample sheet, because I'm sure this sounds very confusing without seeing what I've done thus far:
https://docs.google.com/spreadsheets/d/1KSYihfSaqDxl58J6CLubEsFFeAhltq__CV__wXT9whU/edit#gid=0