function createExpensesSheet(e) {
  var res = e['formInput'];
  var sheetName = res['Sheet Name'] ? res['Sheet Name'] : 'Expenses';
  newSpreadsheet = SpreadsheetApp.create(sheetName);
  newSpreadsheet.setFrozenRows(1);
  newSpreadsheet
    .getActiveSheet()
    .getRange(1, 1, 1, FIELDNAMES.length - 1)
    .setValues([FIELDNAMES.slice(0, FIELDNAMES.length - 1)]);
  var prefills = objToArray(res, FIELDNAMES.slice(0, FIELDNAMES.length - 1));
  prefills.push(newSpreadsheet.getUrl());
  return createExpensesCard(prefills, 'Created and linked the spreadsheet <i>' +
                            sheetName + '</i> for expenses!').build();
}
/**
 * Creates a new spreadsheet for the user to log expenses.
 *
 * @param {Event} e An event object containing form inputs and parameters.
 * @returns {Card}
 */
Creates a new spreadsheet for the user to log expenses.
@param {Event} e An event object containing form inputs and parameters.
@returns {Card}
Creates a new spreadsheet for the user to log expenses . @param { Event } e An event object containing form inputs and parameters . @returns { Card }
function createExpensesSheet(e) {
  var res = e['formInput'];
  var sheetName = res['Sheet Name'] ? res['Sheet Name'] : 'Expenses';
  newSpreadsheet = SpreadsheetApp.create(sheetName);
  newSpreadsheet.setFrozenRows(1);
  newSpreadsheet
    .getActiveSheet()
    .getRange(1, 1, 1, FIELDNAMES.length - 1)
    .setValues([FIELDNAMES.slice(0, FIELDNAMES.length - 1)]);
  var prefills = objToArray(res, FIELDNAMES.slice(0, FIELDNAMES.length - 1));
  prefills.push(newSpreadsheet.getUrl());
  return createExpensesCard(prefills, 'Created and linked the spreadsheet <i>' +
                            sheetName + '</i> for expenses!').build();
}
function createExpensesSheet ( e ) { var res = e [ 'formInput' ] ; var sheetName = res [ 'Sheet Name' ] ? res [ 'Sheet Name' ] : 'Expenses' ; newSpreadsheet = SpreadsheetApp . create ( sheetName ) ; newSpreadsheet . setFrozenRows ( 1 ) ; newSpreadsheet . getActiveSheet ( ) . getRange ( 1 , 1 , 1 , FIELDNAMES . length - 1 ) . setValues ( [ FIELDNAMES . slice ( 0 , FIELDNAMES . length - 1 ) ] ) ; var prefills = objToArray ( res , FIELDNAMES . slice ( 0 , FIELDNAMES . length - 1 ) ) ; prefills . push ( newSpreadsheet . getUrl ( ) ) ; return createExpensesCard ( prefills , 'Created and linked the spreadsheet <i>' + sheetName + '</i> for expenses!' ) . build ( ) ; }
Creates a new spreadsheet for the user to log expenses.
Creates a new spreadsheet for the user to log expenses .