Sep 04 2020 01:09 PM
I am using Excel and Quick Base. Quick Base allows querying data via URL. I have successfully set up and run a query in Excel Power Query from our Quick Base database.
Here is an example of what that Power Query looks like:
let
Source = Csv.Document(Web.Contents("https://hardermech.quickbase.com/db/jkii2h8?act=API_GenResultsTable&usertoken=usertoken&options=csv&...}"
),[Delimiter=","]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true])
in
#"Promoted Headers"
Instead of hard coding the entire text string for the URL, I want to build up the text string (parameterize it) in an Excel cell so that I can reference various values in the spreadsheet, then pull that string into the query source statement above.
I have found some online resources for building a Power Query to reference a specific cell on a spreadsheet.
How do I then reference that parameter correctly in this Source statement?
Sep 04 2020 02:32 PM
SolutionIf that's one cell parameter, you may name such cell
query it and use as parameter
let
GetURL = Excel.CurrentWorkbook(){[Name="URLstring"]}[Content][Column1]{0},
Source = Csv.Document(Web.Contents(GetURL),[Delimiter=","]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true])
in
#"Promoted Headers"
If there are few parameters, idea is the same but you organize you parameter into Excel table, query it, combine value into one string and use to access web resource.
Sep 04 2020 03:42 PM
@Sergei Baklan Fantastic! That worked perfectly. Thank you!
Sep 05 2020 05:52 AM
@JonInPDX , you are welcome
Dec 29 2021 03:40 AM
Dec 29 2021 06:35 AM
Power Query doesn't know which worksheet is active. You may define names on sheets level and when use same name combines with sheet name
Sep 04 2020 02:32 PM
SolutionIf that's one cell parameter, you may name such cell
query it and use as parameter
let
GetURL = Excel.CurrentWorkbook(){[Name="URLstring"]}[Content][Column1]{0},
Source = Csv.Document(Web.Contents(GetURL),[Delimiter=","]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true])
in
#"Promoted Headers"
If there are few parameters, idea is the same but you organize you parameter into Excel table, query it, combine value into one string and use to access web resource.