Skip to content

Instantly share code, notes, and snippets.

@iaindooley
Created August 19, 2020 00:10
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 iaindooley/a51bea432d45b7b6c35db49593f897e6 to your computer and use it in GitHub Desktop.
Save iaindooley/a51bea432d45b7b6c35db49593f897e6 to your computer and use it in GitHub Desktop.
Synch spreadsheet
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