โ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
โ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])
โ
โ
โ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])
โ
โ
โ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")
โ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.
โ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.
Excited to expand your horizons with us? Click here to Register and begin your journey to success!
Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!