- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2022 02:42 AM
Is there any way to export the output data in the Excel format into the dbfs?, I'm only able to do it in the CSV format
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2022 03:02 AM
@Hemanth A try this code.
import openpyxl
wb = openpyxl.load_workbook('/dbfs/PATH/test.xlsx')
ws = wb.active
for row in ws.iter_rows():
print([col.value for col in row])
ws['A1']='A1'
wb.save('/dbfs/PATH/test.xlsx')
# Load its modified version and print values
wb = openpyxl.load_workbook('/dbfs/PATH/test.xlsx')
ws = wb.active
for row in ws.iter_rows():
print([col.value for col in row])
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2022 03:02 AM
@Hemanth A try this code.
import openpyxl
wb = openpyxl.load_workbook('/dbfs/PATH/test.xlsx')
ws = wb.active
for row in ws.iter_rows():
print([col.value for col in row])
ws['A1']='A1'
wb.save('/dbfs/PATH/test.xlsx')
# Load its modified version and print values
wb = openpyxl.load_workbook('/dbfs/PATH/test.xlsx')
ws = wb.active
for row in ws.iter_rows():
print([col.value for col in row])
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2022 04:11 AM
If you are on Azure just create a logic app (or Power Automate) which will be triggered by Rest API call and will do convertion.
If you want you can also save the dataframe directly to Excel using native spark code. It is really easy:
df1 = df.to_pandas_on_spark()
df1.to_excel("output.xlsx")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2022 09:28 AM
Hi @Hemanth A databricks does not support excel format if you really want to export excel files you have to use python or pandas for the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 11:13 AM
The easiest way I fount is to create a dashboard and export from there. It will enable a context menu with options to export to some file types including csv and excel.

