1. Προϊόντα
  2.   Aspose.Cells
  3.   Aspose.Cells FOSS for Python

Aspose.Cells FOSS για Python

Δημιουργήστε, τροποποιήστε και εξάγετε λογιστικά φύλλα Excel από την Python — δωρεάν και ανοιχτού κώδικα, χωρίς εξάρτηση από το Microsoft Office.

Ανοιχτού Κώδικα Βιβλιοθήκη Python για Λογιστικά Φύλλα Excel

Το Aspose.Cells FOSS for Python είναι μια δωρεάν, ανοιχτού κώδικα βιβλιοθήκη για εργασία με αρχεία λογιστικών φύλλων σε εφαρμογές Python. Εγκαταστήστε το με μία εντολή pip install aspose-cells-foss και αρχίστε να δημιουργείτε βιβλία εργασίας, να διαβάζετε κελιά, να εφαρμόζετε στυλ, να δημιουργείτε διαγράμματα και να εξάγετε σε XLSX, CSV, TSV, Markdown ή JSON, όλα χωρίς να απαιτείται το Microsoft Excel ή οποιαδήποτε εξάρτηση από το Office.

Η βιβλιοθήκη εκθέτει ένα καθαρό, Pythonic API που βασίζεται στα Workbook, Worksheet, Cells και Cell, τα γνωστά αντικείμενα που γνωρίζει κάθε προγραμματιστής λογιστικών φύλλων. Διαβάστε και γράψτε κελιά χρησιμοποιώντας τη σημειογραφία αγκύλης (ws.cells["A1"].value = "Hello"), μορφοποιήστε τα με αντικείμενα Font και Fill, και δημιουργήστε διαγράμματα στήλης ή γραμμής χρησιμοποιώντας τις αφιερωμένες μεθόδους add_bar() και add_line() στο ws.charts.

Επειδή η βιβλιοθήκη δεν έχει εξάρτηση από τις εγγενείς βιβλιοθήκες του Office, λειτουργεί με τον ίδιο τρόπο σε Windows, Linux και macOS CI runners, Docker containers και περιβάλλοντα serverless. Το πακέτο markitdown-aspose-cells-plugin επεκτείνει τη βιβλιοθήκη MarkItDown της Microsoft με υποστήριξη XLSX, επιτρέποντας πλήρη εξαγωγή βιβλίου εργασίας σε Markdown με μία κλήση.

Read and Write Excel Files

  • XLSX: Open and save workbooks with full round-trip fidelity.
  • Cell access: Read and write values with ws.cells["A1"] bracket notation.
  • Formulas: Write formula strings stored verbatim in XLSX — evaluated by Excel or LibreOffice on open, not by the library at save time.
  • Multiple export formats: Export to CSV, TSV, Markdown, and JSON.
  • Round-trip safe: Unknown XML parts are preserved verbatim on re-save.

Where Aspose.Cells FOSS Can Be Used

  • Data pipelines: Export database query results directly to XLSX or CSV.
  • Report generation: Build styled, branded Excel reports without Office.
  • Documentation: Convert spreadsheets to Markdown via the MarkItDown plugin.
  • ETL workflows: Read input sheets, transform data, and write output workbooks.
  • CI/CD automation: Generate test-result spreadsheets inside Docker containers.

Styling, Charts, and Security

  • Font and fill: Apply bold, italic, font size, foreground and background colors.
  • Number formats: Set date, currency, and custom number formats per cell.
  • Charts: Build bar, line, pie, area, and stock charts (these five types save to XLSX without error; other chart types raise NotImplementedError on save).
  • AES encryption: Protect workbooks with a password parameter in one line.
  • MarkItDown plugin: markitdown-aspose-cells-plugin adds XLSX export to MarkItDown.

Developer Experience

Aspose.Cells FOSS is installable with a single pip install aspose-cells-foss command. There are no native Office libraries or system packages to install. The library runs on any Python 3.7+ environment without compilation steps.

The API is intentionally small: Workbook, Worksheet, Cells, Cell, Font, Fill, and Chart cover the vast majority of real-world use cases. The codebase is MIT-licensed, hosted on GitHub, and accepts bug reports and pull requests.

Create a Workbook and Write Cells

Install with pip, then create a Workbook, access the first Worksheet, and write values directly to cells using bracket notation. The example also shows how to bold the header row by modifying the cell style before saving.

pip install aspose-cells-foss
from aspose.cells_foss import Workbook

wb = Workbook()
ws = wb.worksheets[0]

# Write values
ws.cells["A1"].value = "Product"
ws.cells["B1"].value = "Revenue"
ws.cells["A2"].value = "Widget"
ws.cells["B2"].value = 42000

# Bold the header row
for col in ["A1", "B1"]:
    style = ws.cells[col].get_style()
    style.font.bold = True
    ws.cells[col].apply_style(style)

wb.save("report.xlsx")

Build a Chart and Export to Multiple Formats

Open the workbook saved above, add a bar chart over a range of rows, then call save() three times with different file extensions — XLSX, Markdown, and CSV — without changing any other code.

from aspose.cells_foss import Workbook

wb = Workbook("report.xlsx")
ws = wb.worksheets[0]

# Add a bar chart over rows 2-10
chart = ws.charts.add_bar(12, 0, 25, 6)
chart.n_series.add("B2:B10", True)
chart.title = "Revenue by Product"

wb.save("report_with_chart.xlsx")

# Export the same workbook to Markdown
wb.save("report.md")

# Or export to CSV
wb.save("report.csv")

Συχνές Ερωτήσεις

What is Aspose.Cells FOSS for Python?

It is a free, MIT-licensed Python library for creating, reading, modifying, and exporting Excel spreadsheets without requiring Microsoft Office.

Which file formats are supported?

XLSX for read/write. Export-only formats include CSV, TSV, Markdown, and JSON. Markdown export is built into the library via save_as_markdown() and requires no plugin. The optional markitdown-aspose-cells-plugin adds XLSX support to Microsoft’s MarkItDown library — it is a separate integration, not a requirement for Markdown export.

Does it require Microsoft Excel or Office?

No. Aspose.Cells FOSS is a pure-Python library with no dependency on Microsoft Office, COM automation, or any proprietary runtime.

How do I install it?

Run pip install aspose-cells-foss. No additional system packages or native extensions are required.

Can I build charts?

Yes. The library supports bar, line, pie, area, and stock chart types via dedicated chart-builder methods on ws.charts. These five types save to XLSX without error. Other chart types (scatter, combo, waterfall, etc.) can be created in memory but raise NotImplementedError when workbook.save() is called.

Is encryption supported?

Yes. Pass a password parameter when saving to protect the workbook with AES encryption.

What is the MarkItDown plugin?

markitdown-aspose-cells-plugin integrates Aspose.Cells FOSS into Microsoft’s MarkItDown library, enabling full XLSX-to-Markdown conversion with a single call.

Where can I find the source code?

The source code, issue tracker, and contribution guide are available on GitHub under the MIT license.

  

Υποστήριξη και Πόροι Μάθησης

 Ελληνικά