Skip to main content

A Python library for creating, reading, and modifying Excel files (.xlsx format)

Project description

Aspose.Cells FOSS

A Python library for creating, reading, and modifying Excel files (.xlsx format) without requiring Microsoft Excel.

PyPI version Python License: MIT

Features

  • Create & Edit Excel Files: Create new workbooks or modify existing .xlsx files
  • Cell Operations: Read/write cell values and formulas
  • Styling: Apply fonts, colors, borders, number formats, and alignment
  • Multiple Worksheets: Add, remove, rename, and manage worksheets
  • Charts: Create and modify charts (line, bar, pie, scatter, combo, waterfall, treemap, and more)
  • Tables: Add and manage ListObject tables with styles and auto-filters
  • Shapes & TextBoxes: Add shapes, text boxes, and pictures with hyperlinks
  • Data Validation: Add dropdown lists, number ranges, and custom validation rules
  • Comments: Add and manage cell comments with author and rich text
  • Hyperlinks: Create links to URLs, emails, files, and internal references
  • Auto-Filters: Apply filtering to data ranges
  • Conditional Formatting: Apply rules-based formatting
  • CSV / JSON / Markdown Export: Save workbooks in multiple text formats
  • Encryption: Password-protect Excel files with AES encryption
  • Workbook & Worksheet Protection: Protect workbook structure and individual sheets

Installation

pip install aspose-cells-foss

Quick Start

Create a new Excel file

from aspose.cells_foss import Workbook

# Create a new workbook
workbook = Workbook()

# Get the first worksheet
worksheet = workbook.worksheets[0]

# Set cell values
worksheet.cells["A1"].value = "Hello"
worksheet.cells["B1"].value = "World"
worksheet.cells["A2"].value = 42
worksheet.cells["B2"].value = 3.14

# Save the workbook
workbook.save("output.xlsx")

Read an existing Excel file

from aspose.cells_foss import Workbook

# Open an existing workbook
workbook = Workbook("input.xlsx")

# Access a worksheet
worksheet = workbook.worksheets[0]

# Read cell values
value = worksheet.cells["A1"].value
print(f"Cell A1 contains: {value}")

Apply styling

from aspose.cells_foss import Workbook

workbook = Workbook()
worksheet = workbook.worksheets[0]
cell = worksheet.cells["A1"]

cell.value = "Styled Text"

# Get and modify the cell style
style = cell.get_style()
style.font.bold = True
style.font.color = "#FF0000"  # Red
style.font.size = 14
cell.apply_style(style)

workbook.save("styled.xlsx")

Add data validation (dropdown list)

from aspose.cells_foss import Workbook, DataValidationType

workbook = Workbook()
worksheet = workbook.worksheets[0]

# Add a dropdown list validation to A1:A10
validation = worksheet.data_validations.add("A1:A10")
validation.type = DataValidationType.LIST
validation.formula1 = '"Option1,Option2,Option3"'

workbook.save("validation.xlsx")

Export to CSV

from aspose.cells_foss import Workbook

workbook = Workbook("input.xlsx")
workbook.save_as_csv("output.csv")

Password protection

from aspose.cells_foss import Workbook

workbook = Workbook()
worksheet = workbook.worksheets[0]
worksheet.cells["A1"].value = "Confidential Data"

# Save with password protection
workbook.save("protected.xlsx", password="mypassword")

# Open a password-protected file
workbook2 = Workbook("protected.xlsx", password="mypassword")

Requirements

  • Python 3.7 or higher
  • pycryptodome >= 3.15.0
  • olefile >= 0.46

Documentation

For more examples and detailed API documentation, see the examples directory.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Project details


Download files

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

Source Distribution

aspose_cells_foss-26.3.1.tar.gz (287.6 kB view details)

Uploaded Source

Built Distribution

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

aspose_cells_foss-26.3.1-py3-none-any.whl (327.8 kB view details)

Uploaded Python 3

File details

Details for the file aspose_cells_foss-26.3.1.tar.gz.

File metadata

  • Download URL: aspose_cells_foss-26.3.1.tar.gz
  • Upload date:
  • Size: 287.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for aspose_cells_foss-26.3.1.tar.gz
Algorithm Hash digest
SHA256 70e0297faf7b0c318b40aaebafca24fc2ddbbc2ee1a3e1795e956734e7443995
MD5 1c8d40ebbcd24f6e85d0af2fd322da9d
BLAKE2b-256 ea158e222a974a20ae740305949ea47e0819e1496c474afdfc8213b51025842f

See more details on using hashes here.

File details

Details for the file aspose_cells_foss-26.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for aspose_cells_foss-26.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 50d2bb8be3d93d594c22b2224bf38886cdb79e1ac7ae43289abcab9ba537de85
MD5 00c86a1dec2e3a92ef7ad2375ad2ce98
BLAKE2b-256 86911535c2fe1d082ebd4e2d53642c3e33043195b29abe594c693c66ff92061e

See more details on using hashes here.

Supported by

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