Create XLSB File Via Python
Generate Excel XLSB Files via your Python Applications without installing Microsoft Office®.
For a developer, who is trying to create XLSB 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 XLSB file. To update XLSB file using Python process is same except that it requires existing file as parameter while creating the Workbook object.
How to Create XLSB File in Python
- Create new Workbook class object having FileFormatType as parameter
- Get the access of required Worksheet using getWorksheets().get(index) method
- Insert data in the accessed cell using Worksheet.getCells().get(indexValue).putValue() method
- Save the document as .xlsb file using save() by passing the file with path as the parameter
Creation Requirements
- For XLSB 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 XLSB 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
What is XLSB File Format?
The XLSB file format is a binary file format used by Microsoft Excel to store spreadsheet data. It stands for Excel Binary Workbook, and it offers several advantages over the more commonly used XLSX format. XLSB files are designed to store data in a binary format, which means they are more compact and load faster than XLSX files.
One of the key benefits of the XLSB format is its efficiency in handling large amounts of data. Since the file is stored in a binary format, it requires less disk space compared to the XML-based XLSX format. This makes XLSB files particularly suitable for workbooks with complex calculations, extensive formulas, or numerous worksheets.
In addition to smaller file size, XLSB files offer improved performance when it comes to opening, saving, and calculating data. The binary format allows for faster data access and manipulation, resulting in quicker operations within Excel.
Furthermore, XLSB files provide enhanced security features. They support password protection at both the workbook and individual sheet levels, allowing users to safeguard their data from unauthorized access or modifications.
It’s worth noting that XLSB files can only be opened and edited in Microsoft Excel, as they are not compatible with other spreadsheet software. However, Excel provides backward compatibility