How to Convert Excel 97–03 to JSON in Python
APIs are great for abstracting away data conversions — especially for old data formats like Excel 97–03.
Using complementary Python code examples, we can easily take advantage of a free API to convert our Excel 97–03 documents into JSON format.
We first need to install the SDK with pip install:
pip install cloudmersive-convert-api-client
Then we can add the below imports and call the function (using our Excel 97–03 file path to make the conversion):
from __future__ import print_function
import time
import cloudmersive_convert_api_client
from cloudmersive_convert_api_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: Apikey
configuration = cloudmersive_convert_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'
# create an instance of the API class
api_instance = cloudmersive_convert_api_client.ConvertDataApi(cloudmersive_convert_api_client.ApiClient(configuration))
input_file = '/path/to/inputfile' # file | Input file to perform the operation on.
try:
# Convert Excel (97-2003) XLS to JSON conversion
api_response = api_instance.convert_data_xls_to_json(input_file)
pprint(api_response)
except ApiException as e:
print("Exception when calling ConvertDataApi->convert_data_xls_to_json: %s\n" % e)
To authenticate our free API calls, we’ll just need a free Cloudmersive API key. These allow a limit of 800 API calls per month with no commitments.
Just like that, we’re all done — we only needed a little Python code to make our Excel 97–03 to JSON conversion.