This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This function gets column numbers by the header name | |
function getColumnNrByName(sheet, name) { | |
var range = sheet.getRange(1, 1, 1, sheet.getMaxColumns()); | |
var values = range.getValues(); | |
for (var row in values) { | |
for (var col in values[row]) { | |
if (values[row][col] == name) { | |
return parseInt(col); | |
} |