数据绑定在谷歌电子表格? [英] Data binding in google spreadsheet?

查看:96
本文介绍了数据绑定在谷歌电子表格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以编写一个将两个单元格绑定在一起的Google应用程序脚本?例如,如果一个表格中的单元格被编辑,它会自动更新另一个表格中的匹配单元格。



因此,如果sheet1具有表示花费的金钱的值单元格A1和sheet2有一个值代表单元格B4中相同的花费,我希望能够更改sheet2.B4或sheet1.A1中的值,并且这两个单元格将始终保持最新状态。

我无法确定如何创建可执行此操作的触发器。

解决方案



-script / reference / script / spreadsheet-trigger-builder#onEdit()rel =nofollow noreferrer> SpreadsheetTriggerBuilder onEdit()

然后脚本需要找到已编辑的单元格,获取值并将该值放入新单元格中。

您可以使用 getRange()



$ b

还请看这个问题:

StackOverflow获取并设置


Is it possible to write a google apps script that "binds" two cells together? For example, if a a cell in one sheet is edited, it will automatically update a matching cell in another sheet.

So if sheet1 had a value representing "money spent" in cell A1, and sheet2 had a value representing the same "money spent" in cell B4, I'd want to be able to change the value in sheet2.B4 or sheet1.A1, and both of the cells will always be up to date.

I'm having trouble determining how to create a trigger that could perform this.

解决方案

You can create a trigger for when a sheet is edited:

SpreadsheetTriggerBuilder onEdit()

Then the script would need to find the cell that got edited, get the value, and put the value into the new cell.

You could use getRange():

getRange(row, column) of the Sheet Class

See this question also:

StackOverflow get and set

这篇关于数据绑定在谷歌电子表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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