Python scripts in LibreOffice Calc using the ScriptForge library
2021-09-24, 15:30–16:00 (Europe/Berlin), Room 1

One of the most advanced uses of spreadsheets is automation by creating macros that perform tasks that go beyond the capabilities of regular functions. In LibreOffice, the main scripting language is Basic, but there is a trend in adopting Python to create user scripts. Starting with LibreOffice 7.2 the ScriptForge library will have Python support for most of its services and methods, which will make it easier for users to create Python scripts. The objective of this talk is twofold: first it will provide a brief overview of how to get started writing Python scripts that use the ScriptForge library and later the Calc service will be introduced, showcasing its main methods. Currently the Calc service has 30 methods and 11 properties that have been documented in the online Help. Hence, this talk seeks to promote ScriptForge and its capabilities among LibreOffice users to boost adoption.

The presentation will start by introducing how to create ScriptForge-based Python scripts using the APSO extension and then move on the creating scripts on separate ".py" files alongside a text editor or any Python IDE. Later on, an overview of ScriptForge's Calc service will be presented, listing all methods and properties. Some examples will be presented and also implemented live to showcase ScriptForge's Python capabilities. Examples will start with basic sheet operations and data read/write to spreadsheets. Emphasis will also be given in more advanced features such as importing data from CSV files and databases. The source code of all examples will be made public in GitHub.

See also: Slides

Rafael Lima is a Computer Scientist, holds a PhD in Production Engineering and works as a professor and researcher in a Brazilian university. Rafael joined the LibreOffice Documentation Team in 2020 and later joined the ScriptForge team in 2021 where he has been contributing by writing and translating help pages as well as creating examples.