formatting – A script for multiple tabs in a single Google Sheet

Can you help me with this script? I've tried modifying it to apply it to several tabs in the same way as the original question. But I think something is wrong. 🙁 Here's the original code and I want this formatting protection script to apply to Secondary2,3,4, and so on.

function onEdit (e) {// This is enabled whenever a change occurs in the sheet

var tabs = [
‘Prek_K’, ‘G1’, ‘G2C’, ‘G2J’, ‘G3’, ‘G4’, ‘G5’, ‘G6’, ‘G7’, ‘G8’, ‘G9’, ‘G10’, ‘G11’, ‘G12’, ‘Withdrawn’ ];
var ss = SpreadsheetApp.getActive ()
for (var i = 0; i <tabs.length; i ++) {
var sheet = ss.getActiveSheet ()
if (sheet.getSheetName () == tabs[i]) {
var entryRange = e.range
var range = sheet.getRange (1, entryRange.getColumn (), 1, entryRange.getNumColumns ()) // This will be your range for formatting from row "1" and the corresponding column depending on the column being edited
Logger.log (entryRange.getA1Notation ())
range.copyFormatToRange (sheet, entryRange.getColumn (), entryRange.getNumColumns () + entryRange.getColumn () – 1, entryRange.getRow (), entryRange.getNumRows () + entryRange.getRow () – 1)
Logger.log (entryRange.getColumn ())
if (entryRange.getColumn () == 1) {// The value of this column will not be allowed changed except for row 1 of this column
if (entryRange.getRow ()! = 1) {// The columns of line "1" will be allowed to be modified
e.range.setValue ((e.oldvalue == undefined? "": e.oldvalue))
}
}
}
}
}