I’m trying to use Power Query editor to get data from an URL and load the result in the adjacent cell in my spreadsheet. However in the destination cell I always get also the table header with the value in the row below.
Here are the steps:
- Copy the URL
- Go to Data > Get Data from Web
- Paste the URL, click ok
status | "success" |
data | |
id | "17088" |
message | "Settings Saved" |
- In the Power Query Editor, click on “Record” (applying step "Navigation")
- Right click “id” and “Drill Down”
- Click on the Home tab
- Close and Load to…
- Choose the destination cell
I wanted just the value "17088" in the destination cell but I always also get the table header “tsepHPScrub” in the destination cell with the value in the column below. Is there a way to only have the "17088" value in the destination cell?
You can select the table, then in the table tools in ribbon, Design Tab, uncheck the Header Row and move up the cell with the value.
Hi Catalin, thank you for your response. Now I am struggling with the fact that after running the query ok for the first time, next time it will complain about the query with the same name already existing; also I don't know how to refer to the second cell value in the vba code. If you want to give it a try please take a look at test2.xlsm:
- Select one of the cells with values
- Click "Macro 1" button
- It works (you'll have the link in column F)
- Select any other value, click the button, it doesn't work
I think you're making things more complicated than it needs to be.
When you add a query, a connection will be also added. If you run the code again, you have to loop through existing connections and delete the previously added connections, and also delete the output table, your code is designed to create one, not to use an existing table.
Thinks can be much easier, but to give an advice, I'll have to understand what are you trying to do , and this is not clear.
Normally, you should put all those codes into a source table, then add a query to take data from the source table, add a column with the query function you have, the output will be a table with 2 columns; the initial column with source codes, in second column you will have the results of that function.
Or , you should have a source table, with 1 cell where you can select the desired code, then just refresh the output table.