Created
August 26, 2021 10:40
-
-
Save gkluoe/bc76b6bcf85fa8d4d771a7ece84252ff to your computer and use it in GitHub Desktop.
This file contains 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
import csv | |
from pprint import pprint | |
# Read a microsoft Teams attendance report CSV file and pares into a dict | |
# that describes the meeting and lists attendences | |
meeting_info = None | |
attendees = None | |
with open('report.csv', 'r') as f: | |
filetext = f.readlines() | |
# The first section of the report file (lines 0-6) is in a key: value format | |
# separated by tabs | |
reader = csv.reader(filetext[0:6], dialect='excel-tab') | |
meeting_info = list(reader) | |
# The second section (also tab-delimited) is in columnar format with headings, so we can read | |
# in with a DictReader to preserve column headings | |
reader = csv.DictReader(filetext[7:], dialect='excel-tab') | |
attendees = list(reader) | |
meeting = {} | |
meeting['title'] = meeting_info[2][1] | |
meeting['start'] = meeting_info[3][1] | |
meeting['end'] = meeting_info[4][1] | |
meeting['attendees'] = attendees | |
# See what we got | |
pprint(meeting) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment