@hims_2021
This error indicates an encoding issue when trying to export an Excel file from Databricks to SharePoint via Power Automate. The specific error message about being "Unable to translate bytes [9A] at index 11" suggests that Power Automate is having trouble processing binary content that's being returned from the Databricks API.
1. Use Base64 Encoding for Binary Content
The most reliable solution for transferring binary files through Power Automate is to use base64 encoding:
python# In your Databricks notebook
import base64
import os
# Path to your Excel file
file_path = '/dbfs/path/to/your/test.xlsx'
# Read the file in binary mode
with open(file_path, 'rb') as f:
file_content = f.read()
# Encode file content as base64
base64_content = base64.b64encode(file_content).decode('utf-8')
# Return the base64 encoded content
dbutils.notebook.exit(base64_content)
Then in Power Automate:
Run the notebook that returns base64 content
Decode the base64 content
Save the decoded content to SharePoint
2. Modify Export API Usage
The issue may be with how the API is handling the binary file. Try these adjustments:
Option A: Use different format parameter
https://databrick-server/api/2.0/workspace/export?path=/filepath/test.xlsx&format=DBC&direct_downloa...
Option B: Use the /api/2.0/dbfs/read endpoint instead
Since you're trying to export an Excel file, it might be better to use the DBFS API directly:
https://databrick-server/api/2.0/dbfs/read?path=/dbfs/filepath/test.xlsx
LR