带有执行引用的getRange()。getFormula()

时间:2018-01-22 15:06:23

标签: google-apps-script google-sheets

让我们说我们有一个公式,指的是另一张纸,如 =HYPERLINK("http://www.w3c.org";AnotherSheet!A1) 是否有一个简单的方法getFormula()但已经执行了引用?

因此函数的结果应该是=HYPERLINK("http://www.w3c.org";"W3C") AnotherSheet!A1="W3C"

2 个答案:

答案 0 :(得分:0)

"一种简单的方法"是主观的。以下是如何使用脚本执行此操作的示例:

SELECT
  date(survey_results.created_at),
  json_build_object(
    'high', ROUND(COUNT(*) FILTER (WHERE (scores#>>'{medic,categories,food_insecurity}' in('high'))) * 1.0 / COUNT(*) FILTER (WHERE (scores#>>'{medic,categories,food_insecurity}' in('high','medium','low'))) * 100,2),
    'medium', ROUND(COUNT(*) FILTER (WHERE (scores#>>'{medic,categories,food_insecurity}' in('medium'))) * 1.0 / COUNT(*) FILTER (WHERE (scores#>>'{medic,categories,food_insecurity}' in('high','medium','low'))) * 100,2),
    'low', ROUND(COUNT(*) FILTER (WHERE (scores#>>'{medic,categories,food_insecurity}' in('low'))) * 1.0 / COUNT(*) FILTER (WHERE (scores#>>'{medic,categories,food_insecurity}' in('high','medium','low'))) * 100,2)
  ) as food_insecurity,
  json_build_object(
    'high', ROUND(COUNT(*) FILTER (WHERE (scores#>>'{medic,categories,motivation}' in('high'))) * 1.0 / COUNT(*) FILTER (WHERE (scores#>>'{medic,categories,motivation}' in('high','medium','low'))) * 100,2),
    'medium', ROUND(COUNT(*) FILTER (WHERE (scores#>>'{medic,categories,motivation}' in('medium'))) * 1.0 / COUNT(*) FILTER (WHERE (scores#>>'{medic,categories,motivation}' in('high','medium','low'))) * 100,2),
    'low', ROUND(COUNT(*) FILTER (WHERE (scores#>>'{medic,categories,motivation}' in('low'))) * 1.0 / COUNT(*) FILTER (WHERE (scores#>>'{medic,categories,motivation}' in('high','medium','low'))) * 100,2)
) as motivation                               
FROM survey_results
GROUP BY date(survey_results.created_at);

相关

  • enter image description here

答案 1 :(得分:-1)

是的,您只需使用getValue()函数而不是getFormula()。

斯特凡