Using javascript to add a new row in a google docs spreadsheet

I would like to be able to have a web page that when a button is pressed it adds a row to a google spreadsheet.
I’ve been reading evrything but havnt quite got there.
Here is my current code can anyone help me to get this working:

function addScore(varName, varScore){
    var spreadSheet = SpreadsheetApp.openById("idhere");
    SpreadsheetApp.setActiveSpreadsheet(ss);
    var sheet = ss.getSheetByName("Sheet1");
    var lastRowIndex = sheet.getLastRow();

  // add a new row
  sheet.getRange("B" + lastRowIndex).setValue(varName);
  sheet.getRange("C" + lastRowIndex).setValue(varScore);
}

function init(){
    gapi.client.setApiKey('apikeyhere');
    addScore("Lee", 778);
}


</script>
<script src="https://apis.google.com/js/client.js?onload=init"></script>