'How Execute Azure data bricks notebook from excel

Is there any way to trigger Azure data bricks notebook from excel, if is there please help me how..?

Many thanks



Solution 1:[1]

Lets address the elephant in the room. Why? I'm not normally one to question the intention but it seems fundamentally a bad idea to execute a databricks notebook via excel. I suspect its a misunderstanding of how databricks works.

That aside.

Consume Data into Excel If you wish to consume data from existing tables in databricks follow this guide https://docs.microsoft.com/en-us/azure/databricks/scenarios/connect-databricks-excel-python-r?msclkid=0d79e22fd04c11ec91e6e808762cb0da

Execute a Notebook via Excel This should be possible although I've never tried from Excel. 1st you need to understand the difference between a notebook and a job. As per the docs:

A job is a way to run non-interactive code in an Azure Databricks cluster.

https://docs.microsoft.com/en-us/azure/databricks/data-engineering/jobs/jobs

So now you understand you are able to submit your notebook as a job. How do you achieve this?

  1. You will need to create your notebook and have it within your databricks workspace (consider using Widgets to parameterise it)
  2. You will need to generate a PAT token or assign a Service Principal the correct permissions (if using SCIM)
  3. You will then use the above details to query the Jobs API with your notebook path and any parameters via a Macro (VBA in your Excel Document). Example for a different API here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 johnFisher1978