Skip to content

Instantly share code, notes, and snippets.

@geektutor
Created August 2, 2021 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geektutor/84a84dafa9a24f77225a8bac66749034 to your computer and use it in GitHub Desktop.
Save geektutor/84a84dafa9a24f77225a8bac66749034 to your computer and use it in GitHub Desktop.
function myFunction() {
// Get all rows in the sheet minus the first
var rows = SpreadsheetApp.getActiveSheet().getDataRange();
var data = rows.getValues();
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
for (var row = 2; row < data.length +1; row++) {
for (var col = 3; col <= data[row].length; col++) {
let cell = sheet.getRange(row, col);
let cellData = cell.getValues()[0][0];
if(cellData.length > 2){
cell.setValue(cellData.charAt(1).toUpperCase());
Logger.log(cellData.charAt(1).toUpperCase())
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment