Save a Pandas DataFrame to Excel file to Azure Databrick blob using Python

NA-UPPUADEVCTBA03 21 Reputation points
2021-01-24T03:35:13.803+00:00

Hi Azure team,

I am wondering if you could help me with a question that I am trying to solve. I would like to load data from excel file and save the modified data back to excel file in the Azure blob storage.

I am able to loaded two tables that are contained in two separate sheets within an excel file using read_file_from_blob function. Now I am trying to save these datasets back to one single excel file with each table on a separate sheet/tab. I am aware there is function named write_to_blob, but it allows only csv format for pandas dataframe object.

Please let me know if this is available in Azure. If you could please point me to the documentation that will be helpful.

Sincerely,

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
1,955 questions
0 comments No comments
{count} votes

Accepted answer
  1. HarithaMaddi-MSFT 10,136 Reputation points
    2021-01-25T12:45:52.097+00:00

    Hi @NA-UPPUADEVCTBA03 ,

    Welcome to Microsoft Q&A Platform. Thanks for posting the query.

    Currently, as per my understanding, there is no support available in databricks to write into excel file using python. Suggested solution would be to convert pandas Dataframe to spark Dataframe and then use Spark Excel connector to write into excel files. This link explains the details clearly for the same requirement.

    Additional reference: how-to-read-excel-file-using-pandas.html, Spark Excel Video

    Please let us know for additional queries and we will be glad to assist further.

    --

    • Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification.
    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. SUNOJ KUMAR YELURU 13,956 Reputation points MVP
    2021-01-24T08:03:40.63+00:00

    Hi @NA-UPPUADEVCTBA03

    Thank You for your question posting in Q & A.

    To save Dataframe to blob using Azure databricks, refer this url.

    If a post helps to resolve your issue, please click the Accept the answer and Click Answered Vote as helpful . By marking a post as Answered and/or Helpful, you help others find the answer faster.