How to Remove an Object from an Online Word Document in Python

Editing a document online can be a complicated process without the right tools — that’s why we have a variety of APIs to assist you in your editing process. Our remove object function can be used to delete any object, such as a paragraph, table, or image, from a Word document.

To leverage this helpful tool in Python, we will first need the path of the object; if you need to obtain the path, you can call other functions with our Get-Tables, Get-Images, or Get-Body APIs to assist.

Image for post
Image for post

Let’s begin by installing the SDK:

pip install cloudmersive-convert-api-client

Then, we can call the remove object function with the following code:

from __future__ import print_function
import time
import cloudmersive_convert_api_client
from cloudmersive_convert_api_client.rest import ApiException
from pprint import pprint

In no time at all, the target object will be removed from your Word document. At this point, if you have finished modifying your document, you can run our Finish Editing API to tie everything together and download the document. Retrieve your personal API key on the Cloudmersive website by creating a free account; this will also give you access to 800 calls/month

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store