JavaScript Responding to button click events in Google Docs custom HTML dialog

I am an Admin of a Google Spreadsheet. Several times a week me and other admins have to add new users to the spreadsheet so I thought it would be easier if we could use a custom HTML dialog to do so.

I am displaying the dialog like so:

function AddRow()
{
    var html = HtmlService.createHtmlOutputFromFile('AddRow')
                  .setSandboxMode(HtmlService.SandboxMode.IFRAME);
    SpreadsheetApp.getUi().showModalDialog(html, 'Add Row') 
}

File AddRow.html is a simple HTML form with text boxes, select elements, etc.

Now is there a way I can access the spreadsheet to add a new row with the values entered by the user?

In the HTML file AddRow.html I tried the following

<script>
    var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = spreadsheet.getSheetByName('2015');
    sheet.insertRows(2, 1);
</script>

However this does not insert a row. If I move that code of the HTML file into a *.gs file it does work so it must be a limitation on HTML files?

Answer:1

How can I determine if a string contains one of the values from an array? For example: var a = ["abc","def","ghi"]; var s = "jskljfdkljflkjk abc jskfdjklsj"; for(var i=0;i<a.length;i++){ if(...

How can I determine if a string contains one of the values from an array? For example: var a = ["abc","def","ghi"]; var s = "jskljfdkljflkjk abc jskfdjklsj"; for(var i=0;i<a.length;i++){ if(...

  1. array values exist php
  2. array_values exist
  3. javascript array values exists

I'm write this code for show get point from asp button and show the point on the map: <script src="http://maps.googleapis.com/maps/api/js"></script> <script> var myCenter; ...

I'm write this code for show get point from asp button and show the point on the map: <script src="http://maps.googleapis.com/maps/api/js"></script> <script> var myCenter; ...

  1. show halfway point google maps
  2. show point on google map
  3. show north point on google maps
  4. show multiple point on google maps
  5. javascript show point on google map
  6. google show point

The code is: var someVariable; // this variable is declared but not initialised... alert(typeof someVariable); // alerts 'undefined' alert(typeof notDeclared); // also alerts 'undefined' ...

The code is: var someVariable; // this variable is declared but not initialised... alert(typeof someVariable); // alerts 'undefined' alert(typeof notDeclared); // also alerts 'undefined' ...

  1. what does ���� mean
  2. what does smh mean
  3. what does boomer mean
  4. what does ok boomer mean
  5. what does the fox say
  6. what does simp mean
  7. what does sos mean
  8. what does dna stand for
  9. what does noel mean
  10. what does asl mean
  11. what does ig mean
  12. what does gap stand for
  13. what does otp mean
  14. what does uwu mean
  15. what does mean
  16. what does goat mean
  17. what does bomboclaat mean
  18. what does pansexual mean
  19. what does woke mean
  20. what does ion mean

I have the following: while($round < $counter) <select name="picks[]" id="winner">'; echo'<option value="'.$row['team1'].'">'.$team1.'</option>'; echo'<option ...

I have the following: while($round < $counter) <select name="picks[]" id="winner">'; echo'<option value="'.$row['team1'].'">'.$team1.'</option>'; echo'<option ...

  1. javascript value from select
  2. javascript value from input
  3. javascript value from promise
  4. javascript value from form
  5. javascript value from array
  6. javascript value from object
  7. javascript value from json
  8. javascript value from table cell
  9. javascript value from radio button
  10. javascript value from checkbox
  11. javascript value from input field
  12. javascript value from dropdown
  13. javascript value from php
  14. javascript value from string
  15. javascript value from id
  16. javascript value from textarea
  17. javascript value from html
  18. javascript value from key
  19. javascript value from text input
  20. javascript value from function