英文:
Select specific json value from cell
问题
[{"value":"+44 1234 98715963","isPrimary":true},{"value":"+44 7784 9122","isPrimary":false}]
在Google表格中,我有一些以JSON(或类似JSON的)格式呈现的信息,例如:
我尝试通过公式和/或脚本实现以下目标:在新单元格中显示标志为“isPrimary”等于true的值。
在上面的示例中,该值为+44 1234 98715963。
英文:
In a Google Sheet, I have information in a json (or json-like?) format as e.g.:
[{"value":"+44 1234 98715963","isPrimary":true},{"value":"+44 7784 9122","isPrimary":false}]
What I am trying to achieve (via formula and/or script) is the following: Show the value where the flag "isPrimary" equals true in a new cell.
In the above example that would be +44 1234 98715963
答案1
得分: 1
=如果您希望在value:
与isPrimary:true
之间直接删除数值,而不一定是查找确切的模式,您可以尝试以下代码:
=index(if(len(A2:A),regexextract(substitute(A2:A,"""",""),":([^:]*),isPrimary:true"),))
英文:
If you wish to bluntly remove the value b/w value:
& isPrimary:true
but definitely not looking for some exact pattern inside, you may give a shot at:
=index(if(len(A2:A),regexextract(substitute(A2:A,"""",""),":([^:]*),isPrimary:true"),))
答案2
得分: 0
=REGEXEXTRACT(B1, ".*""(+\d+ \d+ \d+)"" ""isPrimary"":true")
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论