Skip to content

Instantly share code, notes, and snippets.

@shanewholloway
Created August 30, 2012 18:35
Show Gist options
  • Save shanewholloway/3536969 to your computer and use it in GitHub Desktop.
Save shanewholloway/3536969 to your computer and use it in GitHub Desktop.
Convert Billings.app exported slip ".bex" file into Freckle-style CSV
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)
out.writerow(['Date', 'Person', 'Client/Project', 'Minutes', 'Tags', 'Description', 'Billable', 'Invoiced', 'Invoice Reference'])
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()
delta = (te.endDateTime - te.startDateTime).total_seconds()
minutes = int(delta/60)
if minutes>=1:
out.writerow([date, who, clientProject, minutes, tags, desc,'yes','no',None])
@shanewholloway
Copy link
Author

It's very rough, but it let me give freckle a real try using my data!

@michaelryancaputo
Copy link

Does this work?

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