Critique please - Script to parse call/text logs frm exported Google Voice data.

This script is my first attempt at creating a proper function which I would like to share publicly. I believe it is working correctly at this point. I know I need to flesh out the Help still, and probably add some comments within the script itself. I’d appreciate any feedback on the script though, especially anything related to making it useful to others when I share it. I’m also not sure about some of the objects I used to collect and output the data, I kinda stumbled through them, and would be surprised if there wasn’t room for improvement there by doing things a little differently.

One other thing I feel like I could have handled better somehow is the dependency on HtmlAgilityPack.dll.

Anyway, I’d appreciate any feedback, whether related to the things I mentioned or not.


It looks pretty darned nice! My eye might not be as trained as some of the experts here, but I get what you’re doing. I don’t Google voice so I couldn’t test it, but from a format point of view not bad!

I’m with Will - this looks nice especially since it’s your first attempt. If I had one criticism it would be to change the way you are creating your custom objects. You’re not doing it wrong, but the lines run a bit long. There are a ton of different ways to create custom objects in Powershell, but the most concise to me it using the [PSCustomObject] type accelerator. Using it you can replace line 99 in your script with something like this:

$Calls += [PSCustomObject]@{
                    Contact = $ContactName
                    Time = $CallTime
                    Type = $Type
                    Number = $ContactNum
                    Duration = $Duration
                    Message = $FullText
                    AudioFile = $AudioFilePath

Thanks. I did find a small functionality glitch after posting it last night, but nothing major. When I moved from running it against my small sample group of files to the full 17k+ set of files in my archive, it started throwing a bunch of errors. Turns out that when combining bits of a couple of smaller scripts together into this one, I had lost the where-object bit to filter the incoming files down to just html files. The archive downloaded from google takeout also includes mp3’s of every voicemail or recorded call, so when those weren’t filtered out and the script tried to parse them as html, the scripting gods were displeased.

Matt - Thanks, that definitely looks cleaner. If I’m looking at your example right, it would basically replace everything on lines 99-102, is that correct?

I’ve been working on it again this morning and have found several areas where I could make small improvements. I’m sure I’ve put FAR more time into this script than someone more experienced would have required, but It’s been a good learning experience. I am more excited than I probably should be about finishing this up and offering it up for others to use. I know that the number of people who use Google Voice and need to be able to pull their history into a spreadsheet or such is probably fairly limited, but there are people who need it. Before I started this, I found a handful of scripts in various languages that do something similar, but either don’t work as well or at all, or have fairly significant dependencies. I was really hoping to do this in a way that would let anyone with a modern version of windows run it without any special knowledge or pre-requisites, but using the HTMLAgilityPack seemed like the easiest way to get the job done.

Ok, here is what I think is the “Finished” (For the moment) version. I’d still welcome any feedback of course, as I’m sure there’s still more room for improvement and more for me to learn from this script. As it stands right now though, I believe it’s working properly all around, and good enough to write a blog post about and share on poshcode or such.