[OBSOLETE] Log events to Google Sheets [see post /36719/154 for Github repo and v1.1]

[quote=“RedKnight, post:169, topic:36719”]
For the formatting, see this example. The first three lines are my preferred format, the last one a new logged line that’s not[/quote]
This would require a change in the Google Apps Script. If you open the script back up, it basically takes the values passed from the SmartApp and fills them into an array called newRow, which it finally appends to the sheet with sheet.appendRow.

What I think would work is to add something to copy the format of the previous row on top of the newly added row. It looks like copyFormatToRange might make it easy. Something like this might work (this is untested); Change the last line to:

  var lastRowRange = sheet.getRange(sheet.getLastRow(), 1, 1, sheet.getLastColumn());
  sheet.appendRow(newRow);
  lastRowRange.copyFormatToRange(sheet, 1, sheetGetLastColumn(), sheet.getLastRow(), sheet.getLastRow());

UPDATE
As I was testing this, I found this is unnecessary. If you don’t pre-add the rows, then it seels the appendRow will copy the format of the previous row when adding the new one. It looks like number formats, font style, alignment, and a few other items are copied automatically from the cell directly above. Cell borders are not copied, however.

1 Like