Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

concatenation - Insert Dynamic Value in URL from a Cell in Google Sheet

I am trying to build a URL in a cell (google sheets) which will get some of its values from different cells. I have tried using all different ways I can think of like concatenate, Join, & etc but the problem is that the URL has some curly brackets and " as a requirement and that breaks the formula:

URL Example https://katang.io/?t_pid=1&t_extra={"Source":"stackoverflow","Type":"email","Stategy":"banner"}

So I need "Source":"stackoverflow" to be dynamic

so for example "Source":"Get Value from Cell A1"

Any Help or guidance will be much appreciated


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Things to note:

  1. "" makes a literal " character in a string, so you'll have to double up every one.
  2. The & is the concatenation operator in a formula, so you can use that to get values outside of your string.

Therefore, this formula should work:

="https://katang.io/?t_pid=1&t_extra={""Source"":"""&A1&""",""Type"":""email"",""Stategy"":""banner""}"

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...