Human: is it possible to put content from multiple http requests into single excel table using power query?
ChatGPT:
Yes, it is possible to put content from multiple HTTP requests into a single Excel table using Power Query. Here are the steps you can follow:
- Open a new Excel workbook and navigate to the "Data" tab.
- Click on "Get Data" and select "From Other Sources" > "Blank Query".
- In the Power Query Editor, click on "Home" > "Advanced Editor".
- In the Advanced Editor, enter the following code:
csharplet
Source1 = Web.Contents("http://example.com/api/data1"),
Source2 = Web.Contents("http://example.com/api/data2"),
Content1 = Json.Document(Source1),
Content2 = Json.Document(Source2),
Table1 = Table.FromList(Content1, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
Table2 = Table.FromList(Content2, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
CombineTables = Table.Combine({Table1, Table2})
in
CombineTables
- Replace the URLs in the code with the URLs for the HTTP requests you want to combine.
- Click "Done" and the data from the HTTP requests will be loaded into a single table in Excel.
Note that the above code assumes that the content from the HTTP requests is in JSON format. If the content is in a different format, you may need to modify the code accordingly.
Add a comment