重新加载页面谷歌应用脚​​本

重新加载页面谷歌应用脚​​本

本文介绍了重新加载页面谷歌应用脚​​本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用谷歌应用脚​​本在谷歌网站上重新加载页面?我有一个函数创建一个表单,另一个函数doPost收集表单中提供的数据并将其写入电子表格。电子表格嵌入在同一页面中,我希望重新加载页面以更新电子表格中的视图。



我试图在Site Services中找到某些功能或服务, Ui Services。

这里是代码

 函数doGet(e ){
var appRegistro = UiApp.createApplication()。setTitle('Registre seu Atendimento!')。setHeight(500);
var form = appRegistro.createFormPanel();
var flow = appRegistro.createFlowPanel();
var date = new Date();

//构造菜单
flow.add(appRegistro.createLabel(Data));
flow.add(appRegistro.createTextBox().setName(Data).setValue(date).setReadOnly(true).setText(Utilities.formatDate(date,GMT -02:00,dd / MM / yyyy HH:mm:ss)));
flow.add(appRegistro.createLabel(Ticket ID));
flow.add(appRegistro.createTextBox()。setName(TicketID));
flow.add(appRegistro.createLabel(Ticket Type));
flow.add(appRegistro.createListBox().setName(TicketType)。addItem(TicketType1)。addItem(ticketType2)。addItem(TicketType3)。addItem(TicketType4));
flow.add(appRegistro.createLabel(Demandado por));
flow.add(appRegistro.createListBox().setName(DemandedBy).addItem(DemandedBy1).addItem(DemandedBy1));
flow.add(appRegistro.createLabel(Nome do Analista));
flow.add(appRegistro.createListBox().setName(Analyst).addItem(Analyst1).addItem(Analyst1).addItem(Analyst1));
flow.add(appRegistro.createLabel(Status));
flow.add(appRegistro.createListBox().setName(Status)。addItem(Resolvido)。addItem(Em Tratamento));
flow.add(appRegistro.createLabel(Descrição));
flow.add(appRegistro.createTextArea()。setName(Description).setSize(400,100));
flow.add(appRegistro.createSubmitButton(Salvar));
form.add(flow);
appRegistro.add(form);
返回appRegistro;
}

函数doPost(e){
var app = UiApp.createApplication();
var ss = SpreadsheetApp.openById(0AsXUq-Wd26qMdGFodkNqdERSc3NYaHhUQlRFeFNFQlE);
var DataValue = e.parameter.Data;
var TicketIDValue = e.parameter.TicketID;
var TicketTypeValue = e.parameter.TicketType;
var DemandedByValue = e.parameter.DemandedBy;
var AnalystValue = e.parameter.Analyst;
var StatusValue = e.parameter.Status;
var DescriptionValue = e.parameter.Description;
ss.getActiveSheet()。appendRow([DataValue,TicketIDValue,TicketTypeValue,DemandedByValue,AnalystValue,StatusValue,DescriptionValue])。sort(1,false);
返回应用程序;
}


解决方案

使用电子表格,但也许你可以解决限制,其他答复者已经说过。


  • 你可以在电子表格中编写一个脚本来刷新本身为了查询新的数据?

  • 或者您可以将表单移动到Spreadsheet的一部分吗?也许电子表格上的按钮可以将该表单作为UiApp启动?


How do i reload a page in google sites using google apps script? I have a function that creates a form and another function doPost to collect the data submited in the form and writes it in a spreadsheet. The spreadsheet is embbeded in the same page and i want the page to reload to update the view in the spreadsheet.

I tried to find some function or service in Site Services and Ui Services.

here are the code

function doGet(e) {
var appRegistro = UiApp.createApplication().setTitle('Registre seu Atendimento!').setHeight(500);
var form = appRegistro.createFormPanel();
var flow = appRegistro.createFlowPanel();
var date=new Date();

//Construção do Menu
flow.add(appRegistro.createLabel("Data"));
  flow.add(appRegistro.createTextBox().setName("Data").setValue(date).setReadOnly(true).setText(Utilities.formatDate(date, "GMT -02:00", "dd/MM/yyyy HH:mm:ss")));
flow.add(appRegistro.createLabel("Ticket ID"));
flow.add(appRegistro.createTextBox().setName("TicketID"));
flow.add(appRegistro.createLabel("Ticket Type"));
flow.add(appRegistro.createListBox().setName("TicketType").addItem("TicketType1").addItem("ticketType2").addItem("TicketType3").addItem("TicketType4"));
flow.add(appRegistro.createLabel("Demandado por"));
flow.add(appRegistro.createListBox().setName("DemandedBy").addItem("DemandedBy1").addItem("DemandedBy1"));
flow.add(appRegistro.createLabel("Nome do Analista"));
flow.add(appRegistro.createListBox().setName("Analyst").addItem("Analyst1").addItem("Analyst1").addItem("Analyst1"));
flow.add(appRegistro.createLabel("Status"));
flow.add(appRegistro.createListBox().setName("Status").addItem("Resolvido").addItem("Em Tratamento"));
flow.add(appRegistro.createLabel("Descrição"));
flow.add(appRegistro.createTextArea().setName("Description").setSize(400, 100));
flow.add(appRegistro.createSubmitButton("Salvar"));
form.add(flow);
appRegistro.add(form);
return appRegistro;
 }

function doPost(e) {
var app=UiApp.createApplication();
var ss = SpreadsheetApp.openById("0AsXUq-Wd26qMdGFodkNqdERSc3NYaHhUQlRFeFNFQlE");
  var DataValue = e.parameter.Data;
  var TicketIDValue = e.parameter.TicketID;
  var TicketTypeValue = e.parameter.TicketType;
  var DemandedByValue = e.parameter.DemandedBy;
  var AnalystValue = e.parameter.Analyst;
  var StatusValue = e.parameter.Status;
  var DescriptionValue = e.parameter.Description;
  ss.getActiveSheet().appendRow([DataValue,TicketIDValue,TicketTypeValue,DemandedByValue,AnalystValue,StatusValue,DescriptionValue]).sort(1,false);
  return app;
  }
解决方案

I've not done much work with Spreadsheets but perhaps you could work around the restrictions, the other answerers have stated.

  • Could you write a script in your Spreadsheet to refresh itself in order to poll for new data?
  • Or could you move the form to be part of the Spreadsheet? Perhaps a button on the Spreadsheet could launch the form as a UiApp?

这篇关于重新加载页面谷歌应用脚​​本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 00:07