Excel-Power Query-Blank File Method

Excel-Power Query-Blank File Method

Method 1: Using a Blank File

Step 1: Generate Reports

First, generate the Profit and Loss and Balance Sheet reports by following their respective guides.

Step 2: Access Power Query

  1. Open Excel and go to the Data tab.
  2. Click on Get Data, then select Other Sources.

  3. Choose Blank Query to open the Power Query Editor.

Step 3: Configure Power Query

  1. In the Power Query Editor, go to the Home tab and select Advanced Editor.   
  2. Remove the existing code and replace it with the provided code.

    let

        Token = "Bearer (Paste the Bearer Token Here)",

        Url = "(Profit & Loss API URL)",

        

        GetAPIData = (token as text) as record =>

    let

    Source = Json.Document(Web.Contents(Url, [Headers=[Authorization=token]])),

    AnotherAPICall = if Record.HasFields(Source, {"url"}) then

    Json.Document(Web.Contents(Source[url]))

    else

    Json.Document(Source[data]),

    Result = AnotherAPICall

    in

    Result,

    FinalResult = GetAPIData(Token)

    in

    FinalResult

  3. Replace the placeholder text with your actual Bearer Token and Report API URL and remove Brackets.
       
  4. Click Done.

Step 4: Finalize Data Import

  1. Click on Edit Credentials, select Connect, and set the Privacy level to Public.
  2. Click on Into Table.

  3. Click on the double-sided arrow next to the column header, then select Expand to new rows.
       
  4. Click OK to display the data in Excel.