google-apps-script - 遍历谷歌表格中的单元格并创建具有特定格式的字符串
问题描述
在@Tanaike 的建议下,我重写了我的问题以使其更清楚。
我想处理一个谷歌表并创建一个特定值的字符串。例如,这是一个虚构的数据集,
上面的数据集中有 3 行,我想创建一个文本字符串,其内容如下所述:
这是上面所有图片的谷歌表格链接。
感谢您的时间!
解决方案
在这里,我做了前三个字符串。您可以自己完成其余的工作。
function stupidStrings() {
const ss=SpreadsheetApp.getActive();
const sh=ss.getActiveSheet();
//const rg=sh.getRange("A1:T4");
const rg=sh.getRange(1,1,sh.getLastRow(),sh.getLastColumn);//perhaps this is the modification you are looking for as this will get all of the rows of data
const vA=rg.getValues();
var html="";
html+=Utilities.formatString('<br />AIR***[%s][%s][%s]*99*****\\',vA[1][0],vA[1][1],vA[1][2]);
html+=Utilities.formatString('<br />PAT*[%s]*[%s]****\\',vA[1][3],vA[1][5]);
html+=Utilities.formatString('<br />PRE*[%s][%s][%s]*[%s]**\\',vA[1][12],vA[1][13],vA[1][7],vA[1][19]);
SpreadsheetApp.getUi().showModelessDialog(HtmlService.createHtmlOutput(html), 'Stupid Strings')
}
推荐阅读
- api - KuCoin API 上的这条消息是什么?code: '200000', msg: '接口离线'
- c# - 通知消息 Asp.net Core
- r - 在R中有条件地填充ggplot的背景
- flutter - Flutter / Google Firestore StreamBuilder 没有更新到数据库
- python - 如何在两个 Python 文件之间发送动态变量?
- angular - 防止点击排序进入Angular matTable中的输入
- unity3d - 球在全息镜头中穿过地面,但在统一时效果很好。空间映射
- submit - File.sub 的输入和输出的 HTCondor 问题
- javascript - Vue 应用程序中多个 Highchart 窗格的背景颜色
- c# - 有什么方法可以在不使用前端 javascript 的情况下使用 c# 使用 RestAPI 登录到 Asp.net MVC Web 应用程序?