This article guides on how to check number of words with Python REST API. You will learn counting words in MS Word with Python Low Code API with the help of Python cloud SDK. It will assist you in getting statistics of individual pages in a Word file according to your requirements.
Prerequisite
- Create an account and get API credentials
- Download Aspose.Words Cloud SDK for Python to count words in a Word file
- Setup Python solution project with the above SDK for fetching statistics of a Word file
Steps to Check Word Count with Python Low Code API
- Instantiate the Configuration object and use it to create the WordsApi object for Word file statistics
- Load the source Word file into a byte array for accessing statistics
- Create the request object for the loaded document using the GetDocumentStatisticsOnlineRequest class
- Fetch the statistics using the GetDocumentStatisticsOnline() method
- Display page count, word count on a specific page, and total word count in the loaded document
The above steps describe how to write an application for checking the Word document word count with Python REST API. Load the source Word file and create a request object for document statistics using the GetDocumentStatisticsOnlineRequest() class. Call the GetDocumentStatisticsOnline() method to get the statistics of the World file and display the information.
Code to Count Words in MS Word with Python REST API
This sample code demonstrates how to check word count online with Python REST API for a Word file. The API returns a response object containing the page count, a collection of statics for individual pages, a word count for all the pages, and footnote information. You can perform INQ queries on the statistics collection to fetch specific information to fulfill your application requirements.
This article has taught us to get number of words in Word document with Python Low Code API. To get metadata of a World file, refer to the following article: Extract metadata from Word Document with Python REST API.