Advertisement
nsaunders

Untitled

Oct 10th, 2022
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1.  
  2. const sheetID = "1DalaGJ3rGHmagpUqq3aOXSKRkyZQapfw-bCNTW5lgBE";
  3. const sheetName = "data";
  4.  
  5. function doGet(e) {
  6. var coordinates = [1, 1, 1, 3]; //just grab a few cells from the spreadsheet
  7. var params = JSON.stringify(e);
  8. var htmlOutput = HtmlService.createTemplateFromFile('index');
  9. htmlOutput.params = params;
  10. htmlOutput.update = 'updated value is: ' + e.parameter['update'];
  11. htmlOutput.row = 'row is: ' + e.parameter['row'];
  12. coordinates[0] = row;
  13. coordinates[2] = row;
  14. htmlOutput.values = read(coordinates);
  15. htmlOutput.url = getUrl();
  16. return htmlOutput.evaluate();
  17. }
  18.  
  19. function read(coordinates) {
  20. var sheet = SpreadsheetApp.openById(sheetID);
  21. var data = sheet.getSheetByName(sheetName);
  22. var range = data.getRange(coordinates[0], coordinates[1], coordinates[2], coordinates[3]);
  23. var values = range.getValues();
  24. Logger.log(values);
  25. return values;
  26. }
  27.  
  28. function getUrl() {
  29. var url = ScriptApp.getService().getUrl();
  30. return url;
  31. }
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement