如何使用Apps脚本将值设置为Google表格中的单元格? [英] How to set the value to a cell in Google Sheets using Apps Script?

查看:66
本文介绍了如何使用Apps脚本将值设置为Google表格中的单元格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过脚本在Google表格中设置文本或数字.

I want to set text or number in Google Sheet from script.

我想在单元格F2中设置Hello或数字9.到目前为止,我已经找到了以下代码:

I want to set Hello or number 9 in cell F2. I found this code so far:

SpreadsheetApp.getActiveRange().setValue('hello');

但是没有指定哪个单元格.

but that doesn't specify which cell.

推荐答案

以下代码完成了所需的操作

The following code does what is required

function doTest() {
  SpreadsheetApp.getActiveSheet().getRange('F2').setValue('Hello');
}

这篇关于如何使用Apps脚本将值设置为Google表格中的单元格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆