Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Convert ODT to Word in Python

Convert ODT to Word using Python

This Gist provides the details on how to convert ODT to Word using Aspose.Words Cloud SDK for Python.

In following code snippet, we are first uploading the ODT file to cloud storage and convert the output to DOCX format. The resultant file is also saved in cloud storage. For complete details, please visit Convert ODT to Word using Python.

ODT to Word

Important Links

Home | Product Page | Docs | API Reference | Cloud Dashboard | Code Samples | Source Code | Blog | Free Support | Free Trial

Convert ODT to Word using Python SDK
// for more examples, please visit
def ODTtoWord():
# create an instance of WordsApi
words_api = WordsApi("bbf94a2c-6d7e-4020-b4d2-b9809741374e","1c9379bb7d701c26cc87e741a29987bb")
# Name of input ODT document
inputFileName = 'TableDocument.odt'
# name of resultant Word document
resultantFile = 'Resultant.docx'
# Upload source Word document to Cloud Storage
words_api.upload_file(asposewordscloud.models.requests.UploadFileRequest(open('C:\\Users\\Downloads\\'+inputFileName, 'rb'), "", None))
# Create an object for Document conversion. Specify output format as DOCX
request = GetDocumentWithFormatRequest(inputFileName, "DOCX", None, None, None, None, resultantFile, None)
# initiate ODT to DOCX conversion operation
result = words_api.get_document_with_format(request)
# print message in console (optional)
print('Open document sucessfully converted to DOCX !')
except ApiException as e:
print("Exception while calling WordsApi: {0}".format(e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment