Skip to content

Instantly share code, notes, and snippets.

@iaindooley
Created March 26, 2019 06:31
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/34b1dd8f48a3a087baeb62cac5ab6fdd to your computer and use it in GitHub Desktop.
Save iaindooley/34b1dd8f48a3a087baeb62cac5ab6fdd to your computer and use it in GitHub Desktop.
Aggregate numbers from Custom Fields
function aggregateNumbersDaily(board,signature,original_time)
{
//Create a new sheet in the document for today's date
var sheet = SpreadsheetApp.getActiveSpreadsheet().insertSheet(Trellinator.now().butlerDefaultDate());
var board = new Board(board);
var fields = board.customFields();
//Loop through all the Site Diary cards for Location 1
board.list("Location 1 Site Diary").cards().each(function(card)
{
//Create a row that has card name, and the values of each custom field
var current_row = [card.name()];
fields.each(function(field)
{
current_row.push(card.customFieldValue(field.name()));
});
//append the row to the sheet
sheet.appendRow(current_row);
});
//Run again at the same time tomorrow
ExecutionQueue.push("aggregateNumbersDaily",board,signature,original_time.addDays(1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment