Ive created this script which makes a form to post a blurb, i want it to be submitted to a spreadsheet but i keep getting this error Exception: incorrect range width, was 3 but should be 5
no matter what i change the number of rows in the getRange the numbers in this error are always the same. Is there some kind of way to update the code that I dont know about? I deploy the code every time i change it.
function doGet() {
var app = UiApp.createApplication().setTitle('Form for news update');
//panel for form
var panel = app.createVerticalPanel().setId('panel');
//elements for the form
var postTitle = app.createLabel('Title');
var title = app.createTextBox().setId('title');
var postLabel = app.createLabel('new post:');
var post = app.createTextArea().setId('post');
var btn = app.createButton('Submit');
//handler to execute posting by click the button
var handler = app.createServerClickHandler('Submit');
handler.addCallbackElement(panel);
//add this handler to the button
btn.addClickHandler(handler);
//add the elements to the panel
panel.add(postTitle)
.add(title)
.add(postLabel)
.add(post)
.add(btn);
//add the panel to the app
app.add(panel);
return app;
}
function Submit(e){
//get the app and send it to the spreadsheet
var app = UiApp.getActiveApplication();
try{
//get the post
var postTitle = e.parameter.postTitle;
var title = e.parameter.title;
var post = e.parameter.post;
//put the info into a spreadsheet
var ss = SpreadsheetApp.openById('KEY IN HERE REMOVED FOR PRIVACY');
var sheet = ss.getSheets()[0];
sheet.getRange(sheet.getLastRow()+1, 1).setValues([[ title, post]]);
}catch(e){
app.add(app.createLabel('Error occured:'+e));
return app;
}
}