Monday, August 14, 2017

Copying comments in Google spreadsheet into a column

Will copy every comment on a cell in a column into a cell next to the source column (the one with the comments):

function commentsToColumn() {
  // find selection (the source comments)
  var workbook = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = workbook.getActiveSheet();
  var source = sheet.getActiveSelection();

  // determine target (the column to the left of the selection)
  var target = source.offset(0, +1);

  // copy comments
  comments = source.getComments();
  target.setValues(comments);
}

If you need more info for usage, please ask in comments :).
Post a Comment