Site icon SpreadsheetWeb Help

Powerapps Integration

Step 1: Prepare SpreadsheetWeb API

  1. Upload your Excel file to SpreadsheetWeb Hub to generate the API.
  2. Note the following:
    • API Endpoint URL
    • Workspace ID
    • Application ID

Step 2: Set Up Azure API Management

2.1 Create a New API

  1. Go to Azure API ManagementAPIsHTTP.
  2. Set the API URL to:
     
    https://api.spreadsheetweb.com
  3. Configure optional authentication if needed.

2.2 Configure API Operation

  1. Under Operations, create a new operation:
    • Display Name: Calculate Shipping Cost
    • Method: POST
    • URL: /calculations/calculatesinglesimple
  2. Add Headers:
    • Content-Type: application/json

2.3 Define Request Body

In the Request section, use the following body:

{ "request": { "workspaceId": "your-workspace-id", "applicationId": "your-application-id", "inputs": { "originZIP": "10001", "destinationZIP": "90001", "weight": "1" }, "outputs": ["cost"] } }

2.4 Define Response Body

In the Response section, add a sample response:

{ "response": { "outputs": { "cost": "8.5785" } } }

2.5 Test the API

Save and test the configuration to verify the response.

Step 3: Create a Custom Connector in Power Apps

  1. Open Power AppsDataCustom ConnectorsNew Connector.
  2. Enter the API Endpoint URL and add the Subscription Key (from Azure).
  3. Map the request and response fields.

Step 4: Build the Power Apps UI

4.1 Create Input Fields

  1. Add three Text Input fields:
    • originZIP
    • destinationZIP
    • weight
  2. Add a Button labeled Submit to trigger the API call.
  3. Add a Label for displaying the API result.

Step 5: Set Up Power Automate Flow

5.1 Create a Flow

  1. In Power Automate, create a new flow.
  2. Add three input fields for originZIP, destinationZIP, and weight.

5.2 Call the API

Add a Custom Action to call the API with the following JSON body:

{ "request": { "workspaceId": "your-workspace-id", "applicationId": "your-application-id", "inputs": { "originZIP": "@{triggerBody()['text']}", "destinationZIP": "@{triggerBody()['text_1']}", "weight": "@{triggerBody()['text_2']}" }, "outputs": ["cost"] } }

 

5.3 Return the Response

{
  "cost": "@{body('Custom_API_Call')['response']['outputs']['cost']}"
}

 


Step 6: Connect Power Automate to Power Apps

Link the Submit button in Power Apps to trigger the flow:

Set(apiResponse; TestAPI.Run(originZIP.Text, destinationZIP.Text, weight.Text))  

Display the result in the Label:

Text(apiResponse.cost)

Step 7: Test and Finalize

  1. Input test values for originZIP, destinationZIP, and weight.
  2. Click Submit and verify the calculated result appears in the label.
Exit mobile version