KNOWLEDGEBASE
Python Excel library | Aspose
Aspose.Cells for Python is a class library that allows developers to manipulate and process spreadsheet files within their own applications. Provides the most flexible group of components that enable Python applications to create and manage Excel spreadsheets without requiring Microsoft Excel or other third-party software.
Our API supports the popular spreadsheet (XLS, XLSX, XLSB, XLSM, XLTM, XLTX, CSV, ODS, SpreadsheetML) file formats your business use every day, and allows exporting Excel files to DOCX, PDF, HTML, PPTX, XPS, JSON, MHTML, Plain Text, and popular image formats including JPG, PNG, SVG, TIFF, and BMP.
With our library, developers can manage multiple worksheets, create spreadsheet content and styles from scratch, add common and complex mathematical, financial, and text formulas, import data into worksheets from different data sources, manipulate charts, comments, images, draw objects, and perform many more tasks.
With the Python Excel API, you can perform the following operations:
• Reading Excel spreadsheets
• Adding images and creating charts
• Adjusting worksheets within workbooks
• Rendering Excel spreadsheets to PDF, EMF, and images
• Protecting and unprotecting worksheets
• Creating pivot tables and charts
• Adding and editing comments
• Searching and replacing dana
• Splitting and merging cells
• Adding and removing grouping to columns and rows
• Setting numbers formatting
• Reading and setting formulas
• Configuring page setup
• Adjusting page orientation, paper size, and scaling
• Reading and writing conditional formatting
• And much more
You can try some of the popular features of Aspose.Cells through our online application.
There are two Aspose.Cells libraries at your disposal - Aspose.Cells for Python via Java and Aspose.Cells for Python via .NET library.
Aspose.Cells for Python via Java library
System requirements: Aspose.Cells for Python via Java can be used on Windows, Linux, and macOS platforms and the library is platform-independent. The machine must have Java 8 or higher version before installation.
Python version: Python 3.5 or higher
Java version: Java 1.8 or higher
Installation on Windows, Linux, or mac OS
- Install Java with the following command:
JAVA_HOME=C:\jdk1.8.0_131
PATH=C:\jdk1.8.0_131\bin;
- Install Aspose.Cells for Python via Java from pypi:
$ pip install aspose-cells
Create a Hello World application using Aspose.Cells for Python via Java library
- Create a file named HelloWorldApp.py
- Use the code below and save it in the HelloWorldApp.py file
import jpype
import asposecells
jpype.startJVM()
from asposecells.api import Workbook
# Create an instance of the Workbook class.
workbook = Workbook()
# Insert the words Hello World! into a cell accessed.
workbook.getWorksheets().get(0).getCells().get("A1").putValue("Hello World")
# Save as XLS file
workbook.save("output.xls")
# Save as XLSX file
workbook.save("output.xlsx")
# Save as ods file
workbook.save("output.ods")
jpype.shutdownJVM()
- Run “python HelloWorldApp.py” @command prompt
Converting Excel files
Python Excel library enables the conversion of Excel files into various formats, including PDF, XPS, and HTML. Below we will show you how to quickly and easily convert Excel files using Aspose.Cells for Python via Java library.
// load file to be converted
Workbook wkbk= new Workbook(SD_PATH + "input.xls");
// Convert XLS to PDF, XPS and HTML
wkbk.save(SD_PATH + "output.pdf", SaveFormat.PDF);
wkbk.save(SD_PATH + "output.xps", SaveFormat.XPS);
wkbk.save(SD_PATH + "output.html", SaveFormat.HTML);
Aspose.Cells for Python via .NET library
System requirements: Aspose.Cells for Python via .NET is a platform-independent library and can be used on Windows, Linux, and macOS where
Python is installed.
Python version: Python 3.6 or higher
Installation on Windows, Linux, or mac OS
Install Aspose.Cells for Python via .NET from
pypi using the following command:
$ pip install aspose-cells-python
Create a Hello World application using Aspose.Cells for Python via .NET library
- Create a file named HelloWorldApp.py
- Use the code below and save it in the HelloWorldApp.py file
import aspose.cells
from aspose.cells import Workbook
# Create an instance of the Workbook class.
workbook = Workbook()
# Insert the words Hello World! into a cell accessed.
workbook.worksheets.get(0).cells.get("A1").put_value("Hello World")
# Save as XLS file
workbook.save("output.xls")
# Save as XLSX file
workbook.save("output.xlsx")
# Save as ods file
workbook.save("output.ods")
- Run “python HelloWorldApp.py” @command prompt
Converting Excel files
Below we will show you how to quickly and easily convert Excel files using Aspose.Cells for Python via .NET library.
import aspose.cells
from aspose.cells import Workbook,SaveFormat
#load file to be converted
wk = Workbook("input.xlsx");
#Convert XLS to PDF, XPS and HTML
wk.save("output.pdf", SaveFormat.PDF);
wk.save("output.xps", SaveFormat.XPS);
wk.save("houtput.html", SaveFormat.HTML);
You can find out more about the Aspose.Cells API on the official product page, as well as in our documentation.
If you want to hire our developers to quickly and efficiently implement our API in your project, our professional team is at your disposal. We will work with you to understand your project, design a solution and implement the Aspose API according to your needs, whether you need new features in the existing Aspose product or API for new file formats.