Skip to content

Instantly share code, notes, and snippets.

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/a8f5f90ba46b52eaac05505a4b0ffca7 to your computer and use it in GitHub Desktop.
Save iaindooley/a8f5f90ba46b52eaac05505a4b0ffca7 to your computer and use it in GitHub Desktop.
Import spreadsheet data
function importSpreadsheetData(event)
{
var values = getSpreadsheetDataFromEventTrigger(event);
var board = new Trellinator().board("Production");
board.lists().each(function(list)
{
list.archiveAllCards();
});
for(var i = 0;i < values.length;i++)
{
var target_list = board.findOrCreateList(values[i].column_name);
//data should contain a list of card names for example
for(var j = 0;j < values[i].data.length;j++)
{
//create a card for each work item in the target list
Card.create(target_list,values[i].data[j]);
}
}
}
function getSpreadsheetDataFromEventTrigger(event)
{
//this function deals with the google sheets
//api to get your data as an array following
//an "on edit" trigger or something similar, out
//of scope for this example code
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment