简体   繁体   English

将谷歌工作表中的单元格数据放入 html 输入框。 谷歌应用程序脚本

[英]put cell data from google sheet into html input box. google apps script

I want to put data of C5 into HTML input box.我想将 C5 的数据放入 HTML 输入框。 I just made function bb().我刚刚做了函数 bb()。 and I don't have idea next.我不知道接下来。 plz help me.请帮助我。

 function bb(){ var sheet = SpreadsheetApp.getActiveSheet(); var value = sheet.getRange("C5").getValue(); return value;; }
 <!DOCTYPE html> <html> <head> <base target="_top"> </head> <body> <form name="frm"> <br> Number :&nbsp <input type="text" name="Number" iD="reginum" size="4" / > </form> </body> </html>

Use Apps Script Scriptlets </+ ... ?>使用Apps Script Scriptlets </+ ... ?>

This will allow you to evaluate the return values of Apps Script functions directly within your html .这将允许您直接在html评估 Apps 脚本函数的返回值。

Simple sample:简单示例:

Code.gs代码.gs

function doGet(){  
  return HtmlService.createTemplateFromFile("index.html").evaluate();  
}

function bb(){
  var sheet = SpreadsheetApp.getActiveSheet();
  var value = sheet.getRange("C5").getValue();
  return value;
}

index.html索引.html

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>

<body>
   <form name="frm">
    <br>
       Number   :&nbsp
    <input type="text" name="Number" iD="reginum" size="4" value=<?=bb()?>/>
</form>
</body>
</html>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Apps Script WebApp - 从谷歌表格中的数据更新文本框字段 - Apps Script WebApp - Update text box field from data from a google sheet 需要从 Google Apps 脚本查询 Google 表格以获取特定数据 - Need to Query Google Sheet for specific data from Google Apps Script 如何在使用 Bootstrap 和 HTML5 从 Google Sheet 填充数据的 Google Sheet Apps 脚本中添加“数据列表” - How to Add 'Data List' in Google Sheet Apps Script that Populates Data from from Google Sheet with Bootstrap and HTML5 从Google Apps脚本查询Google表格 - Query a Google Sheet from Google Apps Script 使用 html 对话框中输入字段的值使用 Google Apps 脚本在 code.gs 中进行 var - use value from input field in html dialog box to var in code.gs using Google Apps Script Google Apps 脚本 - 根据 if/else 语句和工作表单元格是否为空白,在 HTML 中插入字符串 - Google Apps Script - inserting a string in HTML based on if/else statement and based on whether the sheet cell is blank 如何使用谷歌应用程序脚本和谷歌工作表数据逐行发送 html 电子邮件 - How to send html email line by line using google apps script and google sheet data 使用 Google Apps 脚本添加/更新 Google 工作表行数据比较 HTML 表单中的值 - 尝试在工作表上查找匹配项并更新所选行数据 - Add/Update Google Sheet Row Data Comparing Values from HTML Form Using Google Apps Script - Trying to Find Match on Sheet & Update Selected Row Data 将 .gs(Google Apps 脚本)中的数据共享到<script> variable in html - Share data from .gs (Google Apps Script) to <script> variable in html 将数组值从Google表格添加到HTML边栏(Google Apps脚本) - Add array values to HTML sidebar from Google Sheet (Google Apps Script)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM