Create XLSX File Via Python

Generate Excel XLSX Files via your Python Applications without installing Microsoft Office®.

 

For a developer, who is trying to create XLSX files via Python application? Aspose.Total for Python via Java API can help to automate the create process. It’s a full package of various APIs dealing different formats including Microsoft Office files and Images. Aspose.Cells for Python via Java API that is part of Aspose.Total for Python via Java package makes this generation process easy. Below is the process of creation. Moreover, developers can easily enhance the application for modification of XLSX file. To update XLSX file using Python process is same except that it requires existing file as parameter while creating the Workbook object.

How to Create XLSX File in Python

Creation Requirements

  • For XLSX generation, reference APIs within the project directly from PyPI ( Aspose.Cells )
  • Or use the following pip command pip install aspose.cells
  • Moreover, Download the API package from the downloads section
 

Create XLSX File in Python

# create a new XLSX workbook
workbook = Workbook(FileFormatType.XLSX)
worksheet = workbook.getWorksheets().get(0)
# Insert a string value to a cell
worksheet.getCells().get("C2").setValue("Image")
# set the 4th row height
worksheet.getCells().setRowHeight(3, 150)
# set the C column width
worksheet.getCells().setColumnWidth(3,50)
# add a picture to the D4 cell
index = worksheet.getPictures().add(3, 3, "aspose-cells-for-python.png")
# get the picture object
pic = worksheet.getPictures().get(index)
# save the Excel file
workbook.save("workbook_with_image.xlsx")
 

Explore Options with Python

Generate CSV File (Comma Seperated Values)
Generate ODS File (OpenDocument Spreadsheet)
Generate TSV File (Tab-separated Values)
Generate XLS File (Microsoft Excel Binary Format)
Generate XLSB File (Excel Binary Workbook)
Generate XLSM File (Macro-enabled Spreadsheet)
Generate XLSX File (Open XML Workbook)
Generate XLT File (Excel 97 - 2003 Template)
Generate XLTM File (Excel Macro-Enabled Template)
Generate XLTX File (Excel Template)

What is XLSX File Format?

The XLSX file format is a widely used file format for storing spreadsheet data in Microsoft Excel. It is the default and standard format for Excel workbooks in recent versions of the software.XLSX files are designed to store data in a structured and efficient manner. They utilize the Open XML format, which is an open standard for storing and manipulating office documents. This format offers several advantages, including smaller file sizes and improved data recovery capabilities.

With XLSX files, users can create, edit, and analyze data in Excel with a wide range of features and functionalities. The format supports various types of data, such as numbers, text, formulas, charts, and formatting options. It also allows for the creation of multiple worksheets within a single workbook, providing organization and flexibility for complex data sets.

One of the significant benefits of the XLSX format is its compatibility with different platforms and software applications. XLSX files can be opened and edited not only in Microsoft Excel but also in other spreadsheet programs like Google Sheets, LibreOffice Calc, and Apple Numbers. This makes it easier to collaborate and share data across different platforms and software environments.

Furthermore, XLSX files offer robust data protection and security features. Users can apply passwords to restrict access to the workbook or specific worksheets, ensuring the confidentiality and integrity of sensitive information.