我创建了带有一些关键字占位符的文本模板。关键字在单独的单元格中,并且有很多。我的想法是,我选择一个文本模板,该模板在另一张纸上带有一个下拉菜单,并自动用所有关键字填充所选文本。我通过VLOOKUP获取模板,并使用SUBSTITUTE和ROW替换行号以从同一行中获取正确的关键字。到目前为止,一切都很好。 我没有得到的是最终评估。输出始终是仅是文本而不是函数公式的公式。
我知道Google电子表格没有Excel中的EVAL功能。所以我需要一种解决方法。
尝试了很多东西,例如INDIRECT函数或来自Internet的一些脚本,这些都是我自己制作的EVAL函数,但仍然无法正常工作。我要疯了。
//MY TEMPLATES:
A B
Version No.1 ""&CXXXXX&" & "&DXXXXX&" presents for your "&EXXXXX&"."
Version No.2 "Perfect for "&CXXXXX&" & "&DXXXXX&". Do some "&EXXXXX&"!"
Version No.3 "Cool "&CXXXXX&" & "&DXXXXX&"."
//MY KEYWORDS:
C D E
Business Money Motivation
Fitness Bodybuilding Sports
Music Songs Sounds
//MY CODE FOR THE EXPECTED OUTPUT:
=CONCATENATE("=";SUBSTITUTE(VLOOKUP($A3;$A$16:$B$18;2;0);"XXXXX";ROW(B3)))
(Templates are placed at A16:B18)
//WHAT I ACTUALLY GET:
Dropdown Output
Version No.2 ="Perfect for "&C3&" & "&D3&". Do some "&E3&"!"
Version No.3 ="Cool "&C4&" & "&D4&"."
Version No.1 =""&C5&" & "&D5&" presents for your "&E5&"."
//WHAT I NEED:
Dropdown Output
Version No.2 Perfect for Business & Money. Do some Motivation!
Version No.3 Cool Fitness & Bodybuilding.
Version No.1 Music & Songs presents for your Sounds.
必须对输出进行评估,但是我没有弄清楚如何在Google Spreadsheets中做到这一点...
在这里您可以找到示例文件:
https://docs.google.com/spreadsheets/d/11vvkhgsbPqDz5sPCkPzNcGNvlHEBhRE72O8pE_keDs0/edit?usp=sharing
答案 0 :(得分:0)
使用Google Apps脚本或Google Sheets API将公式添加到单元格中。
如果您打算使用Google Apps脚本,请使用def spotify(elem1, elem2, elem3):
print("proxy: {}, cc: {}, cvc: {}".format(elem1, elem2, elem3))
PROXY = elem1
creditCard = elem2
securityCode = elem3
restart=input("Do you wish to start again: ").lower()
if restart in yeslist:
spotify(elem1, elem2, elem3)
print("proxy: {}, cc: {}, cvc: {}".format(elem1, elem2, elem3))
else:
exit()
def get_cc():
cc = ['5136154545452522', '51365445452823', '51361265424522']
return cc
def get_cvc():
cvc = ['734', '690', '734']
return cvc
def get_proxies():
proxies = ['51.77.545.171:8080', '51.77.254.171:8080', '51.77.258.82:8080']
return proxies
proxArr = get_proxies()
ccArr = get_cc()
cvcArr = get_cvc()
for elem in zip(proxArr, ccArr, cvcArr):
spotify(elem[0], elem[1], elem[2])
或setFormula
添加一个公式。
也许您应该先阅读https://developers.google.com/apps-script/guides/sheets