question

NaveenSuvvada-8084 avatar image
0 Votes"
NaveenSuvvada-8084 asked SaltveitAndreas-6386 commented

How can i read Share point excel files in azure databricks notebook?

Handling sharepoint files in databricks notebook to perform some transformations.

azure-databricks
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

PRADEEPCHEEKATLA-MSFT avatar image
0 Votes"
PRADEEPCHEEKATLA-MSFT answered SaltveitAndreas-6386 commented

Hello @NaveenSuvvada-8084,

Welcome to the Microsoft Q&A platform.

Unfortunately, you cannot read Share point excel files in Azure Databricks.

Reason: Share point is not supported source in Azure Databricks.

For more details, refer to Azure Databricks - Data sources.

Are there any alternatives?

Yes, there are couples of alternatives to read share point excels files in Azure Databricks.

Option1: Copy excels files to Azure Storage and then mount the storage account to Azure Databricks and read from storage account.

You may checkout the SO thread addressing: Reading Excel file from Azure Databricks.

Option2: I found a third party articles which explains - Process & Analyze SharePoint Data in Azure Databricks.

Disclaimer: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any

Hope this helps. Do let us know if you any further queries.


Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks @PRADEEPCHEEKATLA-MSFT, could you please tell me whether we will be able to access Sharepoint files via Azure Data Factory???

0 Votes 0 ·

Hello @NaveenSuvvada-8084,

You can't copy files from document libraries from SharePoint Online.

For more details, refer to Copy data from SharePoint Online List by using Azure Data Factory or Azure Synapse Analytics.


0 Votes 0 ·


 from office365.sharepoint.client_context import ClientContext
 from office365.runtime.auth.client_credential import ClientCredential
    
 sharepoint_base_url = "https://site.sharepoint.com/sites/group/"
 READ_DIR = "/sites/Group/Shared Documents/Folder/Subfolder
    
 # setup sharepoint access
 client_credentials = ClientCredential(client_id, client_secret)
 ctx = ClientContext(sharepoint_base_url).with_credentials(client_credentials)"
    
 def download_sharepoint_file(file_url):
     temp_dir = tempfile.mkdtemp()
     download_path = os.path.join(temp_dir, os.path.basename(file_url))
     with open(download_path, "wb") as local_file:
         file = ctx.web.get_file_by_server_relative_path(file_url).download(local_file).execute_query()
     return download_path
    
 excel_file_path = download_sharepoint_file(template_file_url)

next just read in excel...

@PRADEEPCHEEKATLA-MSFT Seems you can?

0 Votes 0 ·