Last active
December 15, 2015 02:19
-
-
Save jtuttas/5186724 to your computer and use it in GitHub Desktop.
Geburtstage als ics Datei aus einer CSV Datei
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cls | |
$d = Get-Content .\Geburtstage.csv | |
$filename = "geburtstage.ics" | |
"" | Set-Content $filename | |
$idcount=1; | |
foreach ($zeile in $d) { | |
$daten = $zeile.Split(";") | |
"BEGIN:VCALENDAR" | Add-Content $filename | |
"VERSION:2.0" | Add-Content $filename | |
"PRODID:http://www.mmbbs.de" | Add-Content $filename | |
"METHOD:PUBLISH" | Add-Content $filename | |
"BEGIN:VEVENT" | Add-Content $filename | |
"UID:461092315540"+$idcount+"@mmbbs.de" | Add-Content $filename | |
$organizer = "ORGANIZER;CN="+$daten[1]+" "+$daten[0]+":MAILTO:"+$daten[0]+"@mmbbs.de" | |
$organizer | Add-Content $filename | |
"LOCATION:MMBBS" | Add-Content $filename | |
"SUMMARY:Geburtstag "+$daten[0] | Add-Content $filename | |
"DESCRIPTION: Heute hat "+$daten[1]+" "+$daten[0]+" Geburtstag" | Add-Content $filename | |
"CLASS:PUBLIC" | Add-Content $filename | |
if ($daten[3].Length -lt 2) { | |
$daten[3] = "0"+$daten[3]; | |
} | |
if ($daten[4].Length -lt 2) { | |
$daten[4] = "0"+$daten[4]; | |
} | |
"DTSTART:"+$daten[2]+$daten[3]+$daten[4] | Add-Content $filename | |
"DTSTAMP:"+$daten[2]+$daten[3]+$daten[4] | Add-Content $filename | |
"RRULE:FREQ=YEARLY" | Add-Content $filename | |
"END:VEVENT" | Add-Content $filename | |
"END:VCALENDAR" | Add-Content $filename | |
$idcount++ | |
Write-Host ("Einttrag für "+$daten[1]+" "+$daten[0]+" erzeugt") | |
} | |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thomas;Weber;1968;4;11 | |
Frank;Martin;2012;1;1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment