How to validate an Excel XLSX Spreadsheet in Python

Today let’s apply one of our APIs to make validating Excel spreadsheets trivial, the way it should be. First we install our document client using pip install:

pip install git+

Now simply call validate_document_xlsx_validation using the desired XLSX file:

from __future__ import print_function
import time
import cloudmersive_convert_api_client
from import ApiException
from pprint import pprint
# Configure API key authorization: Apikey
configuration = cloudmersive_convert_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Apikey'] = 'Bearer'
# create an instance of the API class
api_instance = cloudmersive_convert_api_client.ValidateDocumentApi(cloudmersive_convert_api_client.ApiClient(configuration))
input_file = '/path/to/file' # file | Input file to perform the operation on.
# Validate a Excel document (XLSX)
api_response = api_instance.validate_document_xlsx_validation(input_file)
except ApiException as e:
print("Exception when calling ValidateDocumentApi->validate_document_xlsx_validation: %s\n" % e)

And we will be given the validity of the document as well as possible errors and warnings for said document.

Image for post
Image for post

Written by

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