Created
August 19, 2020 00:10
-
-
Save iaindooley/a51bea432d45b7b6c35db49593f897e6 to your computer and use it in GitHub Desktop.
Synch spreadsheet
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
function addOrUpdateSpreadsheetRow(notification) | |
{ | |
var moved = new Notification(notification).movedCard(); | |
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Card Data"); | |
var values = sheet.getDataRange().getValues(); | |
var link = moved.link(); | |
var existing_row = false; | |
for(var i = 0;i < values.length;i++) | |
{ | |
if(values[i][0] == link) | |
{ | |
existing_row = i+1; | |
} | |
} | |
if(!existing_row) | |
{ | |
sheet.appendRow([link,moved.name(),moved.description(),Trellinator.now().toLocaleString()]); | |
} | |
else | |
{ | |
sheet.getRange(existing_row+":"+existing_row).setValues([link,moved.name(),moved.description(),Trellinator.now().toLocaleString()]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment