Guest User

Untitled

a guest
Jul 22nd, 2019
59
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function loadForm() {
  2.  
  3. var ss = SpreadsheetApp.openByUrl(url);
  4. var ws =ss.getSheetByName("Options");
  5. var list
  6. =ws.getRange(1,1,ws.getRange("A2").getDataRegion().
  7. getLastRow(),1).getValues
  8. ()
  9. var htmlListArray = list.map(function(r) {return '<option>' + r[0] +'
  10. </option>' ;}).
  11. join('');
  12.  
  13. return render("page",{list: htmlListArray});
  14.  
  15. }
  16.  
  17. function loadAnalyse() {
  18.  
  19. var ss = SpreadsheetApp.openByUrl(url);
  20. var ws =ss.getSheetByName("Options2");
  21. var list =
  22. ws.getRange(1,1,ws.getRange("A2").getDataRegion().
  23. getLastRow() ,1).getValues(
  24. )
  25. var htmlListArray = list.map(function(r) {return '<option>' + r[0] +
  26. '</option>' ; }).
  27. join('');
  28.  
  29. return render("analyse",{list: htmlListArray});
  30.  
  31. //views
  32. Route.path("form",loadForm);
  33. Route.path("table",loadTable);
  34. Route.path("analyse",loadAnalyse);
  35.  
  36.  
  37.  
  38. loadForm = e.parameter
  39. loadTable = e.parameter.v
  40. loadAnalyse = e.parameter.a
  41.  
  42.  
  43. if(Route[e.parameters.v]) {
  44. return Route[e.parameters.v]();
  45. } else{
  46. return render ("home");
  47. }
  48.  
  49.  
  50. switch(e.parameters.v) {
  51. case v:
  52. return Route[e.parameters.v]();
  53. break;
  54. case a:
  55. return Route[e.parameters.a]();
  56. break;
  57. default:
  58. return render ("Page");
  59. }
RAW Paste Data