Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert CSV to Excel and Excel to CSV in Python
import jpype
import asposecells
jpype.startJVM()
from asposecells.api import Workbook, LoadOptions, SaveFormat
# Create CSV LoadOptions object
loadOptions = LoadOptions(FileFormatType.CSV)
# Create a Workbook object with CSV file's path and the loadOptions
workbook = Workbook("data.csv", loadOptions)
# Save CSV as XLSX
workbook.save("CsvToExcel.xlsx" , SaveFormat.XLSX)
import jpype
import asposecells
jpype.startJVM()
from asposecells.api import Workbook, SaveFormat
# Create a Workbook object with Excel file's path
workbook = Workbook("data.xlsx")
# Save XLSX as CSV
workbook.save("ExcelToCSV.csv" , SaveFormat.CSV)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment