-
-
Save hamiltont/6243649 to your computer and use it in GitHub Desktop.
Converts Billings 3 Slips into CSV readable. Export entire Slip Log by right-clicking on slips, choosing to export, saving as bex. Run this script in any folders containing the bex files. They will be found, parsed, and the output will be written to a CSV file in the same folder
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 | |
import glob | |
import plistlib | |
clientProject = 'My Project' | |
for filename in glob.glob("*.bex"): | |
root = plistlib.readPlist(filename) | |
with open(filename+'.csv', 'wb') as out: | |
out = csv.writer(out, delimiter='|') | |
out.writerow(['Slip', 'Start', 'End', 'Duration (minutes)']) | |
for slip in root.objects: | |
slip = dict(slip) | |
desc = slip.pop('name') | |
who = slip.pop('owner.name') | |
timeEntries = slip.pop('timeEntries') | |
print who, desc | |
print slip | |
tags = 'from_billings_app' | |
for te in timeEntries: | |
date = te.startDateTime.date() | |
# For newer versions of python, use this line | |
# delta = (te.endDateTime - te.startDateTime).total_seconds() | |
delta = (te.endDateTime - te.startDateTime).seconds | |
minutes = int(delta/60) | |
if minutes>=1: | |
out.writerow([desc, te.startDateTime, te.endDateTime, minutes]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a way to adjust this script for Billings Pro? I get an error when I try to run it on line#14 (owner.name). What I am looking for is to have a script that spits out the log as line items with the corresponding comments in each log entry which makes up the entirety of a slip.