Search code examples
jsongoogle-apps-scriptgoogle-sheetsgoogle-sheets-formulacustom-function

Is there an way to reference a cell inside a url in google sheets?


I'm trying to reference a cell inside a URL and I want to know whether it's possible or not. For example, this is my Import Json url.

https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY&symbol=MSFT&apikey=demo

And in A1, I have a value called "AMD".

Is it possible to replace MSFT with AMD by just referencing A1? What I have in mind is similar to this.

https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY&symbol=A1&apikey=demo

=ImportJSON("https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY&symbol=MSFT&apikey=demo")

Google Sheets

=ImportJSON("https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY&symbol=MSFT&apikey=demo")


Solution

  • See if this works

    =IMPORTJSON("https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY&symbol="&A1&"&apikey=demo")

    Example