【问题标题】:Coding In Google Sheets to Create an HTML在 Google 表格中编码以创建 HTML
【发布时间】:2021-07-31 03:57:14
【问题描述】:

基本上我想做的是让谷歌表格接受用户输入并将其插入网站模板,然后用于从该网站抓取信息。

例如: 用户从单元格 A2 中选择“糖果” 然后我想让另一个单元开发网站:www.something.com/candy/secondpart

【问题讨论】:

  • =CONCATENATE("www.something.com/", A2, "/secondpart")
  • 请说明您想要什么以及在哪里?您打算使用 Apps 脚本还是简单的公式?

标签: google-sheets


【解决方案1】:

这应该可行。您需要创建某种触发器来实现这一点,但这将返回 HTML 内容。

function pullDateFromWebsiteBasedOnCell() {
  const theSS = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); //or specify
  const theFirstPart = "https://www.something.com/";
  const theLastpart = "/secondPart/";
  var theMiddlepart = theSS.getRange("A2").getValue();
    var theURL = theFirstPart+theMiddlepart+theLastpart;
    var response = UrlFetchApp.fetch(theURL);
    var theHTMLtext = response.getContentText(); //gets content as HTML blob.
    Logger.log(theHTMLtext);
    return theHTMLtext;
}

【讨论】:

    猜你喜欢
    • 2012-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-30
    • 2018-08-23
    • 2017-03-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多