logo v2 Pandas for LibreOffice

Pandas is a fast, powerful, flexible and easy to use open source data analysis and manipulation tool, built on top of the Python programming language.

★ ★ ★ ★ ★
Base Calc Draw Impress Macro Presentations Writer
Download latest

latest release: 2024-03-21 14:21:33

Description

 Description

Pandas is a fast, powerful, flexible and easy to use open source data analysis and manipulation tool, built on top of the Python programming language.

This is a LibreOffice extension that allows you to use Pandas in LibreOffice python macros and scripts.

Example

# using OooDev to for easy access to LibreOffice
import pandas as pd

from ooodev.dialog.msgbox import MsgBox, MessageBoxType
from ooodev.macro.macro_loader import MacroLoader
from ooodev.office.calc import Calc
from ooodev.utils.info import Info
from ooodev.utils.lo import Lo


def _do_work() -> None:
    # make sure we are working on a Calc Spreadsheet
    doc = Lo.XSCRIPTCONTEXT.getDocument()
    if not Info.is_doc_type(doc_type=Lo.Service.CALC, obj=doc):
        MsgBox.msgbox(
            msg="Not a Calc document",
            title="Error",
            boxtype=MessageBoxType.ERRORBOX,
        )
        return

    # create a data frame and add some data to it.
    df = pd.DataFrame()
    df["Name"] = ["Anil", "Raju", "Arun"]
    df["Age"] = ["32", "34", "45"]

    data = (("Name", "Age"),)  # Column names
    # convert data frame values into something that Calc can use.
    data += tuple(df.itertuples(index=False, name=None))

    sheet = Calc.get_active_sheet()
    # set the data starting at cell A1
    Calc.set_array(values=data, sheet=sheet, name="A1")


def demo(*args) -> None:
    with MacroLoader():
        # using MacroLoader so we can use OooDev in macros
        _do_work()


g_exportedScripts = (demo,)

 

Know Issues

May not work with AppImage on Linux. See AppImage issue.

Homepage: https://github.com/Amourspirit/python-libreoffice-pandas-ext#readme

Repository: https://github.com/Amourspirit/python-libreoffice-pandas-ext

Release List

Release Description Compatibility Operating Systems License Release notes   1.0.5 1.0.5 update 7.0 Linux, Windows, macOS MIT

1.0.5 Update. Flatpak install fix.

Download 1.0.3 Better install error handling during install. 7.0 Linux, Windows, macOS MIT

Better install error handling during install.

Update to OooDev (0.15.0)

Download 1.0.0 Initial Release 7.0 Linux, Windows, macOS MIT

Initial Release

Download

Other Extensions

OOO Development Tools (OooDev)

This project brings to power of OOO Development Tools (OooDev) to LibreOffice as an extension.

06-2024

3173

Not rated yet

Python Numpy Extension for LibreOffice

Numpy is The fundamental package for scientific computing with Python.This is a LibreOffice extension that allows you to use Numpy in LibreOffice python macros and scripts.&

04-2024

1460

Not rated yet

Include Python Path for LibreOffice

Give the ability to include external python paths in LibreOffice. Making other python packages available in Python macros and scripts.

05-2024

1422

Not rated yet

Pandas for LibreOffice

Pandas is a fast, powerful, flexible and easy to use open source data analysis and manipulation tool, built on top of the Python programming language.

04-2024

1550

★ ★ ★ ★ ★

Sqlite for LibreOffice on Windows

Adds sqlite3 support to LibreOffice on Windows.

04-2024

1963

Not rated yet

Feedback

★ ★ ★ ★ ★

Post your review

You cannot post reviews until you have logged in. Login Here.

Reviews

  • zz zz Mar 23, 2024, 3:50 PM (3 months ago)

    ★ ★ ★ ★ ★

    Nice addon, maked me save a lot of time with the bz2 error. If you are having bz2 error using pandas just install this extension and everything will work fine.
    A big thank you to the developper !

RSS feed for reviews on this page | RSS feed for all reviews