export data to word document

Jakub Mitura 1 Reputation point
2021-03-16T16:23:12.927+00:00

I am using databricks for analysis of some clinical data - but in the end in order to include it into my Phd I need to put this data into editable document like google docs, microsoft word... and include there formatted tables (from data frames) text description (so I think about manually created template with placeholders for calculated values which would be automatically filled on the basis of some value from a given dataframe) and some visualizations for example from native databricks, power bi, or R ggplot2 ... .

I suppose problem is quite common, but I was not able to find any good solution

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,078 questions
{count} votes

1 answer

Sort by: Most helpful
  1. HimanshuSinha-msft 19,386 Reputation points Microsoft Employee
    2021-03-17T20:34:40.77+00:00

    Hello JakubMitura-4240,
    Thanks for the ask and using the Microsoft Q&A platform .
    This is a great question and let me be honest here . I have not implemented anything like this , but when i think I believe we need to use the API for Google docs or Word to achieve what you are trying to use . There is no out of the box solution when I found ( inline with what you mentioned ) .

    I could like to point you to python-docx here . I did tried a basic python to create a *.docx and it worked . Since Adb does support Python , I think you should explore more on this .

    from docx import Document
    from docx.shared import Inches
    
    def WriteADoc():
    
        print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.
        document = Document()
    
        document.add_heading('Document Title', 0)
        document.save('demo.docx')
    
    
    if __name__ == '__main__':
       WriteADoc()
    

    Please do let me know how it goes .
    Thanks
    Himanshu
    Please do consider to click on "Accept Answer" and "Up-vote" on the post that helps you, as it can be beneficial to other community members

    0 comments No comments