-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert_ods_xlsx.py
30 lines (22 loc) · 1.01 KB
/
convert_ods_xlsx.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from __future__ import print_function
import time
import cloudmersive_convert_api_client
from cloudmersive_convert_api_client.rest import ApiException
from pprint import pprint
def convent_ods_to_xlsx(input_file, outputfile, KEY):
# Configure API key authorization: Apikey
configuration = cloudmersive_convert_api_client.Configuration()
configuration.api_key['Apikey'] = KEY
# create an instance of the API class
api_instance = cloudmersive_convert_api_client.ConvertDocumentApi(cloudmersive_convert_api_client.ApiClient(configuration))
try:
# Convert ODS Spreadsheet to XLSX
api_response = api_instance.convert_document_ods_to_xlsx(input_file)
time.sleep(0.1)
# pprint(api_response)
with open(outputfile, 'wb') as fp:
fp.write(api_response)
except ApiException as e:
print("Exception when calling ConvertDocumentApi->convert_document_ods_to_xlsx: %s\n" % e)
if __name__ == '__main__':
convent_ods_to_xlsx(input_file, outputfile, KEY)