Skip to content

Instantly share code, notes, and snippets.

@hamiltont
Forked from shanewholloway/gist:3536969
Last active December 15, 2021 14:37
Show Gist options
  • Save hamiltont/6243649 to your computer and use it in GitHub Desktop.
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
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])
@mStudios
Copy link

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.

@kdcpelt
Copy link

kdcpelt commented Dec 15, 2021

Did anyone ever figure this out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment