Forum Discussion
Pulling in a web source that prompts for zip code
Hello!
I am trying to reference a table on a website that is only accessible after entering in a zip code (so the site can display the correct information based on zip). Does anyone know how to pass a set value in order to get to the table?
Thanks in advance!
3 Replies
- parry2k
Super User
Anonymous once you enter the zip code it probably adds that a query parameter in the URL, can you get that URL from the browser and then use that as a starting point, concatenate the zip code from Power BI in the URL, and pull the data.
Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
- AnonymousNot applicable
Thanks parry2k -- I'm not sure if that's what's happening. Here's an example of a site where you're prompted for state and the URL does change once you've chosen a state: https://www.usbank.com/home-loans/mortgage/mortgage-rates.html
My source is more like this where the URL doesn't change (and concatenating the zip at the end doesn't load the page successfully): https://www.bankofamerica.com/deposits/bank-cds/cd-accounts/
I'm not super savvy with web so sorry if I'm misunderstanding or overlooking something simple!
- PhilipTreacy
Super User
Hi Anonymous
So if you are accessing this site in a regualr web browser you'd go to the site then type in the ZIP code, which causes the site to load the data you want?
In doing this if the site URL does not change but the contents of the page are, then the site may be using JavaScript/AJAX to load page contents. It could be just a POST request back to a PHP script but can't tell without seeing the site.
Either way, if the site requires you to input something to the page directly, you can't do this in Power Query/PBI. You'd need to use something like VBA to drive a browser session and input the ZIP code then scrape the data.
https://www.myonlinetraininghub.com/web-scraping-filling-forms
Regards
Phil