Skip to content

prometheus42/libreoffice-ical-importer

Repository files navigation

Import iCalendar

Simple extension for LibreOffice for importing iCalendar files (.ics) into LibreOffice Calc.

Based on a tutorial by Andreas Mantke and his template

Another nice example can be found here.

As introduction for scripting LibreOffice with Python see these sources:

Building LibreOffice extension

To build a LibreOffice extension use the Makefile that is provided with the project:

make zip

To install the extension in LibreOffice execute the following command:

make install

Building standalone applications

The file src/ical2csv_gui.py and src/ical2csv.py contain a CLI and a GUI application to convert iCalendar files into CSV files.

To create a single EXE file for Windows user, a pyinstaller .spec file has to be created:

pyinstaller --onefile --windowed -i images/icon.ico --add-data C:\Users\christian\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\ics\grammar\contentline.ebnf;ics\grammar\ src\ical2csv_gui.py

Alternativly, you can use the provided spec file in the repo:

pyinstaller ical2csv_gui.spec 

Usage in LibreOffice

  1. Download LibreOffice extension: https://github.com/prometheus42/libreoffice-ical-importer/releases/tag/v0.2
  2. Install extension in LibreOffice
  3. Open LibreOffice Calc
  4. Click on the tools ("Werkzeuge") menu and start the import function
  5. Choose iCal file

The fields of the iCal file should be stored as columns in the table.

File list

  • META-INF/manifest.xml -> manifest declaring all parts of the extension
  • description.xml -> XML file with all information about the extension
  • gui.xcu -> XML file for all GUI elements of the extension
  • src/import_ical.py -> python code to read iCalendar file and write data into worksheet
  • registration/license_*.txt -> license files in various languages
  • description/description_*.txt -> info text for extension in various languages
  • images/icon.png -> icon for extension
  • extensionname.txt -> contains the name of the extension for build script
  • build.py -> python script to build .oxt file

Contributions

  • Icon for IcalImporter from GNOME Desktop Tango icon set. Licensed under GNU General Public License version 2.

License

This extension is released under the MIT License.

Requirements

IcalImporter runs under Python 3.6 and newer. Currently (December 2019) LibreOffice seems to ship with Python 3.5.

The following Python packages are necessary: