Download ics file by script


i want to download the ICS Calendar file by script.
I have found Solutions with wget but nothing workt.

The Main Problem i think is the download link, did anyone knows the correct link for downloading the ics files?
In web GUI i can download it but i cant see the download link.
I use the Nextcloud verison 12 with the newest calendar app.

Thank you.


The download link is:
[URI] can be looked up in table ‘oc_calendars’ in your Nextcloud database (prefix might be different from ‘oc_’ in your installation).

I also wrote a bash script that exports calendars from Nextcloud and saves them as an *.ics file. Maybe that can do the work for you. See here:


i have already seen your script and thats realy good work, my problem is that is have to download it from another server.
I have a nextcloud with the sql lite installation without managemnt (the standart) so i cant look at the tables at the db, ore is there a way to do so?

I have testet this command with no success:

wget --auth-no-challenge --no-clobber --http-user=USER --http-password=PASSWORT \ -O ./test.ics “http://IP-ADRESS/remote.php/dav/calendars/USER/CALENDAR_NAME?export

Now i have open the db with DB-Brwoser and i have get the uri, it is the Name of the Calendar.
But when i try to download it i get the Error : Bad Request from wget.

Can you access Nextcloud with a browser at http://[IP-ADRESS]?

I am not very experienced regarding wget - I use curl like this instead:
curl -o test.ics -u USER:PASSWORD "http://[IP-ADRESS]/remote.php/dav/calendars/[USER]/[CALENDAR-URI]?export"
Does that work?

I think i have it, the command that works looks like:
wget --output-document ./calendar.ics --auth-no-challenge --http-user=USER --http-password=“PASSWORD” “http://IP:PORT/remote.php/dav/calendars/USER/Kalender?export”

Thank you for your Help!