简体   繁体   中英

Unrecognized function when add formula to a google sheet using script

I have a formula in my sheet that is: =texte(maintenant();"hh:mm:ss") that works fine to display the time, but when I use google script to add the formula like this: range33.setFormula("=texte(maintenant();\"hh:mm:ss\")"); it show #NOM? unrecognized function "texte" and the formula is the same words for words... Is there a setings somewhere? I just dont understand!

Issues:

  1. Use template literals to construct the formula string

  2. texte and maintenant are locale words for text and now therefore use text and now instead otherwise the formulas won't be translated properly in the sheet and it will show an error.

Solution:

range33.setFormula(`text(now();"hh:mm:ss")`)

Solved! I just put the formula in english within the scripteditor wich is set to english and it automatically translate it to french in my sheet and it works now!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM