我正在练习一点Google脚本,并且想自动化一些无聊的东西。我有一个电子表格,其中有10列。为了自动向其中添加新值,我创建了用户表单。
function showUserForm() {
var template = HtmlService.createTemplateFromFile("userform")
var html = template.evaluate()
html.setTitle("Dodawanie nowej mikroderogi").setHeight(600).setWidth(500);
SpreadsheetApp.getUi().showModalDialog(html, "System");
}
function appendData(data){
var ss = SpreadsheetApp.openByUrl(url);
var ws = ss.getSheetByName("2019");
//var lastRow = sheet.getLastRow();
ws.appendRow(["",data.choice, data.model,"", data.description, data.defect, data.size, data.qty, data.mqa, data.paint, data.ass]);
}
现在我有几个问题
在第一列中,我想添加一些公式来生成签名。我在电子表格中有这样的公式,我输入了年份和下一个数字,但是如何引用最后一行呢?
在第四列中,我想添加vlookup公式以搜索不同工作表中的列表。我也遇到了类似的问题
现在有些更复杂的东西了。我希望添加在画布上绘制的选项。但不是空白。我想上传照片(那样做)并将其用作Canva的背景,在编辑照片后,我想将此文件保存在我的Google驱动器中。甚至有可能吗?
如何使用Google脚本将照片添加到电子表格中?我的意思是,我想存储的不是链接而是真实的照片。然后将其导入(通过签名)到另一张纸
这是我已经用HTML完成的操作
<html>
<head>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<div class="container">
<div class = "row">
<div class="input-field col s6">
<input id="wybdate" type="text" class="datepicker" required>
<label for="wybdate">Date choice</label>
</div>
</div>
<div class="row">
<div class="input-field col s6">
<select id="multi" class = "validate" required>
<option value="" disabled selected>Model choice</option>
<option value="W10875642">First</option>
<option value="W11035532">Second</option>
<option value="W10903795">Third</option>
<option value="W11035531">Fourth</option>
<option value="W10866527">Fifth</option>
<option value="W11033841">Sixth</option>
<option value="W11025835">Seventh</option>
<option value="W10874036">Eighth</option>
</select>
</div>
<div class="input-field col s6">
<input id="ile" type="number" class="validate" required>
<label class="active" for="ile">Quantity</label>
</div>
<div class="input-field col s12">
<input id="opis" type="text" class="validate" required>
<label for="opis">Description</label>
</div>
<div class="input-field col s12">
<input id="dzj" type="text" class="validate" required>
<label for="dzj">MQA</label>
</div>
<div class="input-field col s12">
<input id="lakiernia" type="text" class="validate" required>
<label class="active" for="lakiernia">Painting Line</label>
</div>
<div class="input-field col s12">
<input id="linia" type="text" class="validate" required>
<label class="active" for="linia">Ass</label>
</div>
</div>
</div>
<div class="container">
<form action="#">
<div class="file-field input-field">
<div class="btn">
<span>file</span>
<input type="file" id="defplik" required >
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text" id="defekt" required>
<label for="defekt">Place</label>
</div>
</div>
<p class="range-field">
<input type="range" id="rozmiar" min="0" max="30" value="0" pattern="[1-30]" required>
<label for="rozmiar">Size (in mm)</label>
</p>
</form>
</div>
<div class="input-field col s12">
<button class="btn waves-effect waves-light" id="btn" required>add
<i class="material-icons right">send</i>
</button>
</div>