GithubHelp home page GithubHelp logo

ical2csv's Introduction

ical2csv w/sorted events by start date

alt textalt textalt text

A command line Python script that will read an ics file and write it's contents to a csv file.

Installation

Download the ical2csv.py file.

Dependencies:

  • icalendar
  • Python 3

Note: pip may be called pip3 on some systems with both python2 and python3 as options.

Usage of ical2csv

Call the script and pass in the location of the ics file.

Ex: python ical2csv.py event.ics

ical2txt w/sorted events by start date

Like ical2csv.py, it parses an ics file and writes the output to a text-file. This is more of an agenda style.

Installation of ical2txt

Download the script or clone the project and get it from there.

Dependencies for ical2txt

  • setuptools (just in case : pip3 install setuptools)
  • BeautifulSoup4 (pip3 install beautifulsoup4)
  • icalendar (pip3 install icalendar)
  • recurring-ical-events (pip3 install recurring-ical-events)

Usage of ical2txt

Call the script and pass in the location of the ics file.

Ex: python ical2txt.py event.ics / python3 ical2txt.py event.ics

Note: You can limit output to a certain time period. Useful for week logs and the like:

./ical2txt.py myexport.ics 20210101 20211231

./ical2txt.py myexport.ics 2021-01-01T00:00:00 2021-01-31T23:59:59

NEW AS OF 2021-03-28: Recurring events are now actually processed in ical2txt.py. If no end date is given 5 years from now is chosen.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request 😊

Credits

Lead Developer - ical2csv - Erik Cox

Developer - ical2txt - Martin Møller

Python 3 compatibility and improvements - bozoslivehere

Logic and adjustments to sort events chronologically (Google Calendar doesn't do this in its export) - Martin Møller

Removal of HTML code from events (currently only ical2txt) - Martin Møller

License

The MIT License (MIT)

Copyright (c) 2019 Erik Cox

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ical2csv's People

Contributors

erikcox avatar martinm76 avatar tedsteinmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ical2csv's Issues

TypeError when converting to csv

I exported my ical calendar and then tried to use ical2csv and got the following error:

Traceback (most recent call last):
File "ical2csv.py", line 90, in
sortedevents=sorted(events, key=lambda obj: obj.start) # Needed to sort events. They are not fully chronological in a Google Calendard export ...
TypeError: can't compare datetime.datetime to datetime.date

ical2txt.py doesn't work without start and end time

Hi,
thanks for writing this tool.

I get the following error:

python3 ical2txt.py export.ics    
Extracting events from file: export.ics 

Traceback (most recent call last):
  File "ical2txt.py", line 156, in <module>
    txt_write(filename)
  File "ical2txt.py", line 96, in txt_write
    if sys.argv[2] != '':
IndexError: list index out of range

It works when I use start and end dates:
python3 ical2txt.py export.ics 2021-05-01 2021-05-31

Would also be nice to mention this option in the readme.

Quickfix:

    if len(sys.argv) > 3:
        if sys.argv[2] != '':
            istart=parse(sys.argv[2]).timestamp()
        if sys.argv[3] != '':
            istop=parse(sys.argv[3]).timestamp()

Type Error ical2txt

I tried ical2txt limiting it to a 14 day period and got:

Processing events : Traceback (most recent call last):
File "ical2txt.py", line 176, in
txt_write(filename) # Write the matching events to the textfile. With recurring_ical_events, scoping is already done.
File "ical2txt.py", line 127, in txt_write
if event.location != '': values = values + " [" + event.location + "]" # Only include location if there is one
TypeError: can only concatenate str (not "NoneType") to str

WIthout the date limit, I got the same Type Error as with ical2csv.

May this script do not support Chinese and other not-English language?

('Extracting events from file:', 'rili.ics', '\n')
Traceback (most recent call last):
File "ical2csv.py", line 87, in
csv_write(filename)
File "ical2csv.py", line 69, in csv_write
wr.writerow(values)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)

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.