通过代码编写电子表格功能 [英] Writing spreadsheet function via code
问题描述
= split(A1,)
(分隔符是空格)
我如何使用代码?
我试过了...
var splitCell == SPLIT(A1,);
SpreadsheetApp.getActiveSpreadsheet()。getSheetByName(Sheet1)。getRange(B1)。setFormula(splitCell);
但是引号显然是毁灭性的。因此,如何在这种情况下处理引号?
编辑
对不起。脑屁。
var splitCell ='= SPLIT(A8,)';
我已经尝试过(大约一百万次),但是当我刚刚尝试过时(再次)它没有任何问题。
谢谢
(我相信在未来我会回复更少的臭味问题) 解决方案
当我问我的问题时,我不被允许回答我自己的问题(新手在这里有限制)。然而,我的问题的答案是在我的问题的已编辑部分中陈述的。
我对这种混淆表示歉意,但当时我没有其他选择可用所以我的问题仍然是未答复,即使我已经解决了它。
无论如何,答案是:
var splitCell ='= SPLIT(A8 ,)';
I want to write this into the range B1..
=split(A1," ")
(the delimiter is a space)
How do I do it using code?
I tried this...
var splitCell = "=SPLIT(A1," ")";
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1").getRange("B1").setFormula(splitCell);
But the quotes are obviously ruinous. Therefore how are quotes handled in such instances?
EDIT
Sorry. Brain-fart.
var splitCell = '=SPLIT(A8," ")';
I thought that I had already tried that (about a million times) but when I just tried it (again) it worked no problem.
Thanks anyway
(I'm sure I'll be back with less smelly questions in the future)
At the time that I asked my question, I was not allowed to answer my own question (newbies here have limitations). However the answer to my question was stated in the "edited" part of my question.
I apologize for the confusion, but at the time I had no other options available to me, so therefore my question remained "Unanswered" even though I already resolved it.
Anyway, the answer is: var splitCell = '=SPLIT(A8," ")';
这篇关于通过代码编写电子表格功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!