Skip to main content

Product Page | Docs | API Reference | Demos | Blog | Code Samples | Free Support | Temporary License | EULA

Try our free online apps demonstrating some of the most popular Aspose.Cells functionality.

Overview

Aspose.Cells for Python via .NET is a powerful spreadsheet management library that allows developers to create, format, and manipulate Excel files programmatically without the need for Microsoft Excel. It supports features like:

  • Creating Pivot Tables

  • Advanced conditional formatting

  • Conversion to PDF, HTML, JSON

  • Charts, Smart Markers, OLE objects

  • Filtering data

Aspose.Cells API Features

  • Spreadsheet generation & manipulation via API

  • High-quality file format conversion & rendering

  • Print Microsoft Excel® files to physical or virtual printers

  • Combine, modify, protect, or parse Excel® sheets

  • Apply worksheet formatting and page setup

  • Create & customize Excel® charts, Pivot Tables, conditional formatting, slicers, tables & spark-lines

  • Convert Excel® charts to images & PDF

  • Formula calculation engine supporting basic and advanced Excel functions

Supported Read & Write Formats

  • Microsoft Excel®: XLS, XLSX, XLSB, XLSM, XLT, XLTX, XLTM, SpreadsheetML

  • OpenOffice: ODS, SXC, FODS

  • Text: JSON, TXT, CSV, TSV, Tab-Delimited

  • Web: HTML, MHTML

  • iWork®: Numbers

Save Excel® Files As

  • Microsoft Word®: DOCX

  • Microsoft PowerPoint®: PPTX

  • Microsoft Excel®: XLAM

  • Fixed Layout: PDF, XPS

  • Text: JSON, TXT, CSV, TSV, Tab-Delimited, XML

  • Image: TIFF, PNG, BMP, JPEG, GIF, SVG

  • Metafile: EMF

  • Markdown: MD

Examples

Create Excel file from scratch

# import the python package
import aspose.cells
from aspose.cells import License, Workbook, FileFormatType

# Instantiating a Workbook object
workbook = Workbook()
# Get the first worksheet
worksheet = workbook.worksheets[0]
# Get the "A1" cell
cell = worksheet.cells.get("A1")
# Write "Hello World" to  "A1" in the first sheet
cell.put_value("Hello World!")
# Saving this workbook to XLSX
workbook.save("HelloWorld.xlsx")

Convert Excel XLSX file to PDF

# import the python package
import aspose.cells
from aspose.cells import Workbook

# Instantiating a Workbook object
workbook = Workbook("HelloWorld.xlsx")
# Saving this workbook to PDF
workbook.save("HelloWorld.pdf")

Create a chart

from aspose.cells import Workbook
from aspose.cells.charts import ChartType

# Instantiating a Workbook object
workbook = Workbook()
# Adding a new worksheet to the Excel object
sheetIndex = workbook.worksheets.add()
# Obtaining the reference of the newly added worksheet by passing its sheet index
worksheet = workbook.worksheets[sheetIndex]
# Adding sample values to cells
worksheet.cells.get("A1").put_value(50)
worksheet.cells.get("A2").put_value(100)
worksheet.cells.get("A3").put_value(170)
worksheet.cells.get("A4").put_value(300)
worksheet.cells.get("B1").put_value(160)
worksheet.cells.get("B2").put_value(32)
worksheet.cells.get("B3").put_value(50)
worksheet.cells.get("B4").put_value(40)
# Adding sample values to cells as category data
worksheet.cells.get("C1").put_value("Q1")
worksheet.cells.get("C2").put_value("Q2")
worksheet.cells.get("C3").put_value("Y1")
worksheet.cells.get("C4").put_value("Y2")
# Adding a chart to the worksheet
chartIndex = worksheet.charts.add(ChartType.COLUMN, 5, 0, 15, 5)
# Accessing the instance of the newly added chart
chart = worksheet.charts[chartIndex]
# Adding SeriesCollection (chart data source) to the chart ranging from "A1" cell to "B4"
chart.n_series.add("A1:B4", True)
# Setting the data source for the category data of SeriesCollection
chart.n_series.category_data = "C1:C4"
# Saving the Excel file
workbook.save("Chart.xlsx")

Convert Excel workbook to JSON

from aspose.cells import Workbook

# Instantiating a Workbook object
workbook = Workbook()
# Obtaining the reference of the newly added worksheet
sheet = workbook.worksheets[0]
cells = sheet.cells
# Setting the value to the cells
cells.get("A1").put_value("First name")
cells.get("A2").put_value("Simon")
cells.get("A3").put_value("Kevin")
cells.get("A4").put_value("Leo")
cells.get("A5").put_value("Johnson")

cells.get("B1").put_value("Age")
cells.get("B2").put_value(32)
cells.get("B3").put_value(33)
cells.get("B4").put_value(34)
cells.get("B5").put_value(35)

cells.get("C1").put_value("Value")
cells.get("C2").put_value(123.546)
cells.get("C3").put_value(56.78)
cells.get("C4").put_value(34)
cells.get("C5").put_value(9)
# Saving the Excel file to json
workbook.save("Out.json")

Convert Excel to Pandas DataFrame

import pandas as pd
from aspose.cells import Workbook

# Create a new Aspose.Cells Workbook
workbook = Workbook()
# Get the first worksheet
worksheet = workbook.worksheets[0]
# Get the cells
cells = worksheet.cells
# Add header and data values to specific cells
cells.get("A1").value = "Name"
cells.get("B1").value = "Age"
cells.get("C1").value = "City"
cells.get("A2").value = "Alice"
cells.get("B2").value = 25
cells.get("C2").value = "New York"
cells.get("A3").value = "Bob"
cells.get("B3").value = 30
cells.get("C3").value = "San Francisco"
cells.get("A4").value = "Charlie"
cells.get("B4").value = 35
cells.get("C4").value = "Los Angeles"

rowCount = cells.max_data_row
columnCount = cells.max_data_column

# Read the header row (row 0) and store column names
columnDatas = []
for c in range(columnCount + 1):
    columnDatas.append(cells.get_cell(0, c).value)

# Create an empty pandas DataFrame with column names from Excel
result = pd.DataFrame(columns=columnDatas, dtype=object)

# Read each data row (from row 1 onward) and add to the DataFrame
for i in range(1, rowCount + 1):
    rowarray = [cells.get_cell(i, j).value for j in range(columnCount + 1)]
    result.loc[i - 1] = rowarray

print(result)

Combine two workbooks into one

from aspose.cells import Workbook

# Load the first Workbook
SourceBook1 = Workbook("first.xlsx")
# Load the second Workbook
SourceBook2 = Workbook("second.xlsx")
# Combine the second workbook into the first workbook
SourceBook1.combine(SourceBook2)
# Save the combined workbook to a new file
SourceBook1.save("combined.xlsx")

Product Page | Docs | API Reference | Demos | Blog | Free Support | Temporary License | EULA

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

aspose_cells_python-26.8.0-py3-none-win_amd64.whl (59.2 MB view details)

Uploaded Python 3Windows x86-64

aspose_cells_python-26.8.0-py3-none-macosx_11_0_arm64.whl (72.4 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

aspose_cells_python-26.8.0-py3-none-macosx_10_14_x86_64.whl (75.6 MB view details)

Uploaded Python 3macOS 10.14+ x86-64

File details

Details for the file aspose_cells_python-26.8.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for aspose_cells_python-26.8.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 bc76cdcb9f8e59a417ca0eaf8dd8c24135ad5cde6aeaab26e8b0c3408cd42b90
MD5 3e77d586cfb12366cb553138a6570fdf
BLAKE2b-256 84b6b1d4a7f0e3b9b2a39614d8cf24a3a780e86cbf9c2137878760faccc62e69

See more details on using hashes here.

File details

Details for the file aspose_cells_python-26.8.0-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for aspose_cells_python-26.8.0-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 23cdc5d0ca40f4c6568334f1830dc4e0c3e9b1f23c5c8e90d333c67bc3582c29
MD5 9b31a9e48960996fa0a13715976ebb95
BLAKE2b-256 37af61eb118ed65eb6bf0eaa46a46ea5fb9eb2eae374abf410d4752b2ee745ad

See more details on using hashes here.

File details

Details for the file aspose_cells_python-26.8.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for aspose_cells_python-26.8.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d2c55670e2ec3ed193e6da1cd5d4b304d4ab849859f5c5e72c7bd1e8d32f4b24
MD5 477db8f68180ca738b388d63b868a188
BLAKE2b-256 eced2296fd9653b96447854b6f3d61fefbfb3a443c4974d1a4fa204e8811c057

See more details on using hashes here.

File details

Details for the file aspose_cells_python-26.8.0-py3-none-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for aspose_cells_python-26.8.0-py3-none-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 a95a7ab7126d5bf740cf84dd6066fa8627bf2831e10d4eda269d61c0d9ec20f3
MD5 16bf2e2626306a5a8e2c54f52aa69d4f
BLAKE2b-256 67a5df6539b7908aeb4a845698d090e7abf1edbf47c5a4a8156940057e36f29b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

26.8.0 This release

4 files

26.7.0

4 files

26.6.0

4 files

26.5.0

4 files

26.4.0

4 files

26.3.0

4 files

26.2.0

4 files

26.1.0

4 files

25.12.0

4 files

25.11.0

4 files

25.10.0

4 files

25.9.0

4 files

25.8.0

4 files

25.7.4

1 file

25.7.0

5 files

25.6.0

5 files

25.5.1

2 files

25.5.0

3 files

25.4.0

5 files

25.3.0

5 files

25.2.0

5 files

25.1.0

5 files

24.12.0

4 files

24.11.0

5 files

24.10.0

5 files

24.9.0

5 files

24.8.0

5 files

24.7.0

5 files

24.6.0

5 files

24.5.0

5 files

24.4.0

5 files

24.3.0

5 files

24.2.0

5 files

24.1.0

5 files

23.12.0

5 files

23.11.1

4 files

23.11.0

5 files

23.10.0

4 files

23.9.0

4 files

23.8.0

4 files

23.7.0

4 files

23.6.0

4 files

23.5.0

4 files

23.4.0

2 files

23.3.0

3 files

23.2.0

3 files

23.1.0

4 files

22.12.0

4 files

22.11.0

4 files

22.10.0

4 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page