Coder Social home page Coder Social logo

prometheus42 / libreoffice-ical-importer Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 2.0 61 KB

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

License: MIT License

Python 97.21% Makefile 2.79%
libreoffice openoffice extension libreoffice-extension openoffice-extension python3 icalendar libreoffice-calc

libreoffice-ical-importer's Introduction

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:

libreoffice-ical-importer's People

Contributors

prometheus42 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

rayculp odoochain

libreoffice-ical-importer's Issues

ValueError: A VEVENT must have at most one CATEGORIES - Why aren't multiple categories supported?

I figured I can use ical2csv.py directly from command line so I tried converting a calendar exported by Thunderbird.
After some processing time I get following error:

src/ical2csv.py ~/Dokumente/Privat.ics
Writing to CSV file: /home/me/Dokumente/Privat.ics.csv
Reading iCalendar file...
Traceback (most recent call last):
File "src/ical2csv.py", line 91, in
convert_ical_file()
File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "src/ical2csv.py", line 66, in convert_ical_file
write_csv_file(read_ical_file(icalendar_file), csv_file)
File "src/ical2csv.py", line 24, in read_ical_file
c = Calendar(calendar_file.read())
File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/ics/icalendar.py", line 69, in init
self._populate(containers[0]) # Use first calendar
File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/ics/component.py", line 59, in _populate
parser(self, lines) # Send a list or empty list
File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/ics/parsers/icalendar_parser.py", line 71, in parse_vevent
calendar.events = set(map(event_factory, lines))
File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/ics/parsers/icalendar_parser.py", line 69, in event_factory
return Event._from_container(x, tz=calendar._timezones)
File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/ics/component.py", line 31, in _from_container
k._populate(container)
File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/ics/component.py", line 54, in _populate
raise ValueError(
ValueError: A VEVENT must have at most one CATEGORIES

Why are multiple categories not supported? Ics-py seems able to process them.
I also checked my .ics file: All events have at most one category…

I also opened an issue there: ics-py/ics-py#373

Recurring events

Does this tool also handle recurring events?
It seems that only the first day is imported.

Can't install in LibreOffice: No module named 'dateutil' (or 'dateutil.tz' is unknown)

I'm using Ubuntu 20.04.5 LTS and LibreOffice 7.3.2.2 .
I cloned the repo, installed Ics.py via
pip install ics
, changed into the directory and then built the extension with
./build.py
When trying to install the extension in LibreOffice, I got following error:
ErrorMessage_when_installing_in_LibreOffice

Checking dateutil again:
pip install python-dateutil
returns

Requirement already satisfied: python-dateutil in /usr/lib/python3/dist-packages (2.7.3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.