根据我的电子表格中的一个单元格,我试图用数据填充我的其他单元格。这就是我之后......
A1 = date #1 (Only value entered manually in the spreadsheet)
A2 = date #2 (based on A1)
A3 = date #3 (based on A1)
A4 = value #1 (based on A2)
A5 = value #2 (based on A3)
在电子表格单元格A2中的计算方式如下(如果A1不是工作日,则获取上一个工作日):
=WORKDAY(A1+1, -1)
在电子表格单元格A3中计算如下:(如果A1 + 1个月不是工作日,则获取上一个工作日):
=WORKDAY(EDATE(A1, 1)+1, -1)
A4基于A2的结果如此:
A4 = getA4(A2); //The getA4-function is already written
A5基于A3的结果如此:
A5 = getA5(A3); //The getA5-function is already written
一种解决方案是:
1. Read the A1 cell to the script
2. Write the two WORKDAY formulas to the spreadsheet from the script.
3. Read the values of A1 and the now generated A2 and A3 cells from the spreadsheet.
4. Send the values of A2 and A3 to the getA4 and getA5-methods
5. Then write the resulting values to the spreadsheet using setFormulas(newRangeWithAllOfTheValues);
我的问题:
由于我试图最小化对电子表格的读/写,我想只在一次读/写中执行此操作。所以我想要:
A)...将两个WORKDAY函数转换为JS函数,以便我可以直接调用getA4和getA5,或者......
B)...在脚本中运行两个WORKDAY函数(如果它甚至可能),这样我就可以在变量中得到结果,然后直接调用getA4和getA5。
而且我也不知道如何做......