[英]Can I run function of multiple Google sheets from Master Google Sheet?
I have created 10 Google sheets ( copies of parent sheet) which has the same code seperately.我创建了 10 个 Google 表格(父表格的副本),它们分别具有相同的代码。 I want to run some function in all 10 Google sheets from the Parent Google sheet.
我想在 Parent Google 工作表的所有 10 个 Google 工作表中运行一些 function。 For Example I want to run the following function in all 10 sheets without opening them from the parent Google sheet.
例如,我想在所有 10 张工作表中运行以下 function 而不从父 Google 工作表中打开它们。 Ex to delete all Entries in 10 sheets
Ex 删除 10 张表中的所有条目
function deleteentries () function 删除条目 ()
Is it possible by using Google sheet url?是否可以使用 Google 表格 url? Or provide me any other solution.
或者为我提供任何其他解决方案。
I am new to appScript so explain your answer step by step.我是 appScript 的新手,因此请逐步解释您的答案。
Thank you for you help.谢谢你的帮助。
Collect all sheet IDs in your master project, put them into array and trigger the function for each of them within for
loop, where you loop the array with sheet IDs.收集主项目中的所有工作表 ID,将它们放入数组并在
for
循环中为每个工作表触发 function,您可以在其中使用工作表 ID 循环数组。
var sheets = ['sheet1 id as string', 'sheet2 id as string'];
function loopAndDoSomething(){
for (var d=0; sheets.length; d++){
deleteentries(sheets[d]);
}
}
you send sheet id as function parameter and in deleteentries() you can open that sheet by ID and do something with it.您将工作表 ID 作为 function 参数发送,在 deleteentries() 中,您可以按 ID 打开该工作表并对其进行处理。 That would be one possible approach.
那将是一种可能的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.