Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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