Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert Excel to CSV in Python
# For more code samples, please visit https://github.com/aspose-cells-cloud/aspose-cells-cloud-python
def XLSMtoCSV():
try:
#Client credentials
client_secret = "1c9379bb7d701c26cc87e741a29987bb"
client_id = "bbf94a2c-6d7e-4020-b4d2-b9809741374e"
# initialize CellsApi instance
cellsApi = asposecellscloud.CellsApi(client_id,client_secret)
# input XLSB workbook
input_file = "myDocument.xlsm"
# resultant format
format = "CSV"
# resultant file name
output = "Converted.csv"
# call the API to convert XLSM to CSV
response = cellsApi.cells_workbook_get_workbook(name = input_file, format=format, out_path=output)
# print response code in console
print(response)
# print message in console (optional)
print('XLSM sucessfully converted to CSV !')
except ApiException as e:
print("Exception while calling CellsApi: {0}".format(e))
print("Code:" + str(e.code))
print("Message:" + e.message)
Learn how to convert Excel to CSV in Python using Aspose.Cells Cloud SDK for Python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment