Google apps script 谷歌脚本用户界面-阅读和发布电子表格,链接到填充的用户界面
我已经创建了一个UI,我想用它来阅读并发布到一个应用程序。请暂时忽略A列中的链接格式。现在,这是链接到表单。我想改为使用UI,并将在完成此设置后立即删除对链接表单的引用 我希望最终结果是: 1.提交新条目时,经理会收到带有链接的电子邮件Google apps script 谷歌脚本用户界面-阅读和发布电子表格,链接到填充的用户界面,google-apps-script,google-apps,Google Apps Script,Google Apps,我已经创建了一个UI,我想用它来阅读并发布到一个应用程序。请暂时忽略A列中的链接格式。现在,这是链接到表单。我想改为使用UI,并将在完成此设置后立即删除对链接表单的引用 我希望最终结果是: 1.提交新条目时,经理会收到带有链接的电子邮件 该链接将打开用户界面 顶部(灰色)区域将根据ID号(A列)填充电子表格中的相关值 底部区域将为空白,或填充电子表格中的相关值(如果存在) 用户将根据需要填写底部区域,然后提交 输入到UI中的数据将在正确的列中填充电子表格 查看电子表格的用户将能够单击ID号,它
function doGet(e) {
var complaintApp = UiApp.createApplication().setTitle("Complaint Follow-Up").setWidth(1100).setHeight(1000);
//For pre-populating
var prePanel = complaintApp.createAbsolutePanel().setWidth('100%').setStyleAttributes({background: 'D8D8D8'})
var infoGrid = complaintApp.createGrid(2, 6).setStyleAttributes({fontWeight: "bold", }).setWidth('100%');
var idNum = complaintApp.createLabel('Complaint ID #:').setStyleAttributes({textAlign: 'right', float: 'left'});
infoGrid.setWidget(0, 0, idNum);
infoGrid.setWidget(0, 1, complaintApp.createTextBox().setName('ID').setId('ID').setStyleAttributes({float: 'left'}));
infoGrid.setWidget(0, 2, complaintApp.createLabel('Submitted by:').setStyleAttributes({textAlign: 'right', margin: "0 auto"}));
infoGrid.setWidget(0, 3, complaintApp.createTextBox().setName('subBy').setId('subBy').setStyleAttributes({margin: "0 auto"}));
infoGrid.setWidget(0, 4, complaintApp.createLabel('Submitted at:').setStyleAttributes({textAlign: 'right'}));
infoGrid.setWidget(0, 5, complaintApp.createTextBox().setName('subAt').setId('subAt').setStyleAttributes({float: 'left'}));
infoGrid.setWidget(1, 2, complaintApp.createLabel('Time since complaint \(in hours\):').setStyleAttributes({textAlign: 'right'}));
infoGrid.setWidget(1, 3, complaintApp.createTextBox().setName('timeSince').setId('timeSince').setWidth(50));
var guestGrid = complaintApp.createGrid(2, 8).setStyleAttributes({fontWeight: "bold"}).setWidth('100%');
guestGrid.setWidget(0, 0, complaintApp.createLabel('Guest name:').setStyleAttributes({textAlign: 'right'}));
guestGrid.setWidget(0, 1, complaintApp.createTextBox().setName('gName').setId('gName'));
guestGrid.setWidget(0, 2, complaintApp.createLabel('Room #:').setStyleAttributes({textAlign: 'right'}));
guestGrid.setWidget(0, 3, complaintApp.createTextBox().setName('roomNum').setId('roomNum'));
guestGrid.setWidget(0, 4, complaintApp.createLabel('Dates of Stay:').setStyleAttributes({textAlign: 'right', float: 'right'}));
guestGrid.setWidget(0, 5, complaintApp.createTextBox().setName('arrDate').setId('arrDate').setStyleAttributes({float: 'right'}));
guestGrid.setWidget(0, 6, complaintApp.createLabel(' - ').setStyleAttributes({margin: '0 auto'}));
guestGrid.setWidget(0, 7, complaintApp.createTextBox().setName('depDate').setId('depDate').setStyleAttributes({float: 'right'}));
guestGrid.setWidget(1, 0, complaintApp.createLabel('Email Address:').setStyleAttributes({textAlign: 'right'}));
guestGrid.setWidget(1, 1, complaintApp.createTextBox().setName('email').setId('email'));
guestGrid.setWidget(1, 2, complaintApp.createLabel('Phone Number:').setStyleAttributes({textAlign: 'right'}));
guestGrid.setWidget(1, 3, complaintApp.createTextBox().setName('phone').setId('phone'));
var complaintGrid = complaintApp.createGrid(2, 2).setStyleAttributes({fontWeight: "bold", margin: "0 auto"}).setWidth('100%');
complaintGrid.setWidget(0, 0, complaintApp.createLabel('Complaint concerns:'));
complaintGrid.setWidget(1, 0, complaintApp.createTextArea().setName('department').setId('department').setWidth(200));
complaintGrid.setWidget(0, 1, complaintApp.createLabel('Complaint:'));
complaintGrid.setWidget(1, 1, complaintApp.createTextArea().setName('complaint').setId('complaint').setWidth(800).setHeight(100).setStyleAttributes({overflow: "auto"}));
var detailsGrid = complaintApp.createGrid(2, 6).setStyleAttributes({fontWeight: 'bold'}).setWidth('100%');
detailsGrid.setWidget(0, 0, complaintApp.createLabel('First attempt at resolution by:').setStyleAttributes({textAlign: 'right'}));
detailsGrid.setWidget(0, 1, complaintApp.createTextBox().setName('firstRes').setId('firstRes'));
detailsGrid.setWidget(0, 2, complaintApp.createLabel('First attempt at resolution at:').setStyleAttributes({textAlign: 'right'}));
detailsGrid.setWidget(0, 3, complaintApp.createTextBox().setName('firstTime').setId('firstTime'));
detailsGrid.setWidget(0, 4, complaintApp.createLabel('Resolution provided:').setStyleAttributes({textAlign: 'right'}));
detailsGrid.setWidget(0, 5, complaintApp.createTextArea().setName('resList').setId('resList'));
detailsGrid.setWidget(1, 0, complaintApp.createLabel('Appeasement amount:').setStyleAttributes({textAlign: 'right'}));
detailsGrid.setWidget(1, 1, complaintApp.createTextBox().setName('appeasement').setId('appeasement'));
detailsGrid.setWidget(1, 2, complaintApp.createLabel('Guest mindset after initial resolution:').setStyleAttributes({textAlign: 'right'}));
detailsGrid.setWidget(1, 3, complaintApp.createTextBox().setName('mindset').setId('mindset'));
detailsGrid.setWidget(1, 4, complaintApp.createLabel('Is follow-up required?').setStyleAttributes({textAlign: 'right'}));
detailsGrid.setWidget(1, 5, complaintApp.createTextBox().setName('followup').setId('followup'));
var topPanel = complaintApp.createHorizontalPanel().setStyleAttributes({borderStyle: "groove", borderWidth: "2", borderColor: "threedface"}).setWidth('100%');
var guestPanel = complaintApp.createCaptionPanel('Guest Information').setStyleAttributes({background: "#D8D8D8", fontWeight: 'bold'});
var complaintPanel = complaintApp.createCaptionPanel('Complaint Information').setStyleAttributes({background: "#D8D8D8", fontWeight: 'bold', overflow: 'auto'});
var detailsPanel = complaintApp.createCaptionPanel('Initial Resolution Attempt').setStyleAttributes({fontWeight: 'bold'});
topPanel.add(infoGrid);
guestPanel.add(guestGrid);
complaintPanel.add(complaintGrid);
detailsPanel.add(detailsGrid);
prePanel.add(topPanel);
prePanel.add(guestPanel);
prePanel.add(complaintPanel);
prePanel.add(detailsPanel);
complaintApp.add(prePanel);
//Take info
var subPanel = complaintApp.createAbsolutePanel().setWidth('100%').setStyleAttributes({background: '#FBFBEF'})
var form = complaintApp.createFormPanel();
var flow = complaintApp.createFlowPanel();
var grid1 = complaintApp.createGrid(2, 1).setStyleAttributes({margin: "0 auto"});
grid1.setWidget(0, 0, complaintApp.createHTML("<br/>"));
grid1.setWidget(1, 0, complaintApp.createLabel("Please fill out the following, where applicable.")
.setStyleAttributes({textDecoration: "underline", fontSize: "16", fontWeight: "bold"}));
var fuGrid = complaintApp.createGrid(1, 7).setStyleAttributes({margin: "0 auto"})//.setWidth('100%');
var userName = complaintApp.createTextBox().setName('userName').setId('userName').setStyleAttributes({float: 'left'})
fuGrid.setWidget(0, 0, complaintApp.createLabel("Your name:").setStyleAttributes({textAlign: 'right', fontWeight: "bold"}));
fuGrid.setWidget(0, 1, userName);
fuGrid.setWidget(0, 2, complaintApp.createLabel("Date/time of follow-up:").setStyleAttributes({textAlign: 'right', fontWeight: "bold"}));
var fuDate = complaintApp.createDateBox().setFormat(UiApp.DateTimeFormat.DATE_SHORT).setName('fuDate').setId('fuDate').setStyleAttributes({float: 'left'})
fuGrid.setWidget(0, 3, fuDate);
var fuHour = complaintApp.createListBox().setName('fuHour').setId('fuHour').setWidth(60).setStyleAttributes({float: 'left'}).addItem("Hr");
var fuMin = complaintApp.createListBox().setName('fuMin').setId('fuMin').setWidth(60).setStyleAttributes({float: 'left'}).addItem("Min");
for (h=0;h<24;++h){
if(h<10){var hourstr='0'+h}else{var hourstr=h.toString()}
fuHour.addItem(hourstr)
}
for (m=0;m<60;++m){
if(m<10){var minstr='0'+m}else{var minstr=m.toString()}
fuMin.addItem(minstr)
}
fuGrid.setWidget(0, 4, fuHour.setStyleAttributes({float: 'left'}));
fuGrid.setWidget(0, 5, fuMin.setStyleAttributes({float: 'left'}));
var fuDescGrid = complaintApp.createGrid(2, 4).setStyleAttributes({fontWeight: "bold", margin: "0 auto"}).setWidth('100%')
fuDescGrid.setWidget(0, 1, complaintApp.createLabel('Description of Follow-up:'));
var fuDesc = complaintApp.createTextArea().setName('fuDesc').setId('fuDesc').setWidth(500).setHeight(70).setStyleAttributes({overflow: "auto"})
fuDescGrid.setWidget(1, 1, fuDesc);
fuDescGrid.setWidget(1, 2, complaintApp.createLabel('Amount of appeasement:'));
var fuApp = complaintApp.createTextArea().setName('fuApp').setId('fuApp');
fuDescGrid.setWidget(1, 3, fuApp);
var resSubClose = complaintApp.createGrid(1, 3).setStyleAttributes({margin: "0 auto"})
var resHandler = complaintApp.createServerHandler("resolved");
var resolved = complaintApp.createCheckBox("Issue is fully resolved.").setName("resCB").addValueChangeHandler(resHandler).setStyleAttributes({margin: "0 auto"});
resSubClose.setWidget(0, 0, resolved)
resSubClose.setWidget(0, 1, complaintApp.createSubmitButton("Submit"));
var closeHandler = complaintApp.createServerHandler("close");
var close = complaintApp.createButton("Close").addClickHandler(closeHandler);
resSubClose.setWidget(0, 2, close)
var resTf = complaintApp.createLabel("test").setId("resTf").setVisible(false)
subPanel.add(grid1);
flow.add(fuGrid);
flow.add(fuDescGrid);
flow.add(resSubClose);
form.add(flow);
subPanel.add(form);
complaintApp.add(subPanel);
complaintApp.add(resTf);
//var spreadSheet = SpreadsheetApp.getActiveSpreadsheet();
//spreadSheet.show(complaintApp);
return complaintApp;
}
function resolved(e){
var app = UiApp.getActiveApplication();
if (e.parameter.resCB == true){
app.getElementById('resTf').setText("Yes")
return app;
}
}
function close(e) {
var app = UiApp.getActiveApplication();
app.close();
return app;
}
函数doGet(e){
var complamintapp=UiApp.createApplication().setTitle(“投诉跟进”).setWidth(1100).setHeight(1000);
//用于预填充
var prePanel=complaintApp.createAbsolutePanel().setWidth('100%').setStyleAttributes({background:'D8D8D8'})
var infoGrid=complaintApp.createGrid(2,6).setStyleAttributes({fontWeight:“bold”,}).setWidth('100%);
var idNum=complaintApp.createLabel('Complaint ID#::').setStyleAttributes({textAlign:'right',float:'left'});
setWidget(0,0,idNum);
infoGrid.setWidget(0,1,completApp.createTextBox().setName('ID').setId('ID').setStyleAttributes({float:'left'}));
infoGrid.setWidget(0,2,completApp.createLabel('submittedby:')).setStyleAttributes({textAlign:'right',margin:'0auto}));
infoGrid.setWidget(0,3,completApp.createTextBox().setName('subBy').setId('subBy').setStyleAttributes({margin:'0 auto}));
infoGrid.setWidget(0,4,completApp.createLabel('Submitted at:')).setStyleAttributes({textAlign:'right'}));
infoGrid.setWidget(0,5,completApp.createTextBox().setName('subAt').setId('subAt').setStyleAttributes({float:'left'}));
infoGrid.setWidget(1,2,complaintApp.createLabel('自投诉以来的时间\(小时\):')).setStyleAttributes({textAlign:'right'}));
infoGrid.setWidget(1,3,completApp.createTextBox().setName('timeSince').setId('timeSince').setWidth(50));
var guestGrid=complaintApp.createGrid(2,8).setStyleAttributes({fontWeight:“bold”}).setWidth('100%);
setWidget(0,0,completApp.createLabel('Guest name:')).setStyleAttributes({textAlign:'right'}));
setWidget(0,1,completApp.createTextBox().setName('gName').setId('gName'));
setWidget(0,2,completApp.createLabel('Room#::').setStyleAttributes({textAlign:'right'}));
setWidget(0,3,completApp.createTextBox().setName('roomNum').setId('roomNum'));
setWidget(0,4,completApp.createLabel('Dates of Stay:')).setStyleAttributes({textAlign:'right',float:'right'});
setWidget(0,5,completApp.createTextBox().setName('arrDate').setId('arrDate').setStyleAttributes({float:'right'}));
setWidget(0,6,completApp.createLabel('-').setStyleAttributes({margin:'0 auto'}));
setWidget(0,7,completApp.createTextBox().setName('depDate').setId('depDate').setStyleAttributes({float:'right'}));
setWidget(1,0,completApp.createLabel('Email Address:')).setStyleAttributes({textAlign:'right'}));
guestGrid.setWidget(1,1,completApp.createTextBox().setName('email').setId('email'));
setWidget(1,2,completApp.createLabel('Phone Number:')).setStyleAttributes({textAlign:'right'}));
setWidget(1,3,completApp.createTextBox().setName('phone').setId('phone'));
var complaintGrid=complaintApp.createGrid(2,2).setStyleAttributes({fontWeight:“bold”,margin:“0 auto”}).setWidth('100%);
complaintGrid.setWidget(0,0,complaintApp.createLabel('complaintconcerns:');
complaintGrid.setWidget(1,0,complaintApp.createTextArea().setName('department').setId('department').setWidth(200));
complaintGrid.setWidget(0,1,complaintApp.createLabel('Complaint:');
complaintGrid.setWidget(1,1,complaintApp.createTextArea().setName('complaint').setId('complaint').setWidth(800).setHeight(100).setStyleAttributes({overflow:'auto}));
var detailsGrid=completApp.createGrid(2,6).setStyleAttributes({fontWeight:'bold'}).setWidth('100%);
detailsGrid.setWidget(0,0,completApp.createLabel('第一次尝试解析:')).setStyleAttributes({textAlign:'right'}));
detailsGrid.setWidget(0,1,completApp.createTextBox().setName('firstRes').setId('firstRes'));
detailsGrid.setWidget(0,2,completApp.createLabel('第一次尝试解析:')).setStyleAttributes({textAlign:'right'}));
detailsGrid.setWidget(0,3,completApp.createTextBox().setName('firstTime').setId('firstTime'));
detailsGrid.setWidget(0,4,1)