import-gvhistory: Export Google Voice SMS/Text Messages and Call logs to CSV using Powershell

Here is a script I wrote to parse the thousands of HTML files produced by Google Takeout when exporting Google Voice data.  This script parses the html files to gather the Contact Name, Number, time, type (Placed/received etc), duration, and (text/voicemail) message contents for every phone call and text message, and outputs them as a powershell object which can be further filtered or manipulated and then exported into a csv or other format as needed.

Basic examples of how to use this script are included in the script comments.  If you download the script and have trouble, or if it works perfectly, please leave a comment and let me know.

**Update 12/20/2014** I've just posted step by step instructions for how to use the script..
**Update 11/16/2015** The script has been updated due to a change in how Google Takeout exports the timestamps.

Comments

  1. Hey. First and foremost, thank you for writing this. I've been looking for a way to make this data useful for a while. That being said, I'm having trouble getting this to work. I'm pretty new to PowerShell so I could just be doing something wrong but as of now, running the script just yields an empty CSV (or nothing at all if I don't include the export-csv part). Some guidance would be much appreciated. Thanks in advance!

    ReplyDelete
    Replies
    1. Thanks Peter. I've added a new post with step by step instructions, and updated this post with a link. If you have any more trouble let me know.

      Delete
    2. Thanks for the update and all of your help! The script wound up working perfectly!

      Delete
  2. I'm getting the following error when I run the script:

    Cannot find an appropriate constructor to instantiate the custom attribute object for type 'Alias'.
    At C:\temp\gvtext\import-gvhistory.ps1:32 char:11
    + [Alias <<<< ()]
    + CategoryInfo : InvalidOperation: (Alias:Token) [], Run
    + FullyQualifiedErrorId : CannotFindConstructorForCustomAttribute

    I'm sure it's probably something that should be obvious, but any help appreciated.

    ReplyDelete
    Replies
    1. Dann - That sounds like one of the same issues that Peter ran into. While you can safely comment out line 32 by putting a # at the beginning of the line, I suspect that the root of the issue may be that you're running an old version of powershell. Do you know which version your using?

      Win7 shipped with Powershell v2.0, but you can get version 4.0 (the latest available for Win7 currently) by downloading and installing the "Windows Management Framework 4" package from Microsoft. If you're running Windows 7 and don't have that installed already, then that's probably your issue.

      Delete
    2. That was it. Figured it'd be something like that. Thanks!

      Delete
  3. i am using 4.0 and I get a bunch of these errors:

    New-Object : Cannot find type [HtmlAgilityPack.HtmlDocument]: verify that the assembly containing this type is loaded.
    At C:\voice\import-gvhistory.ps1:94 char:20
    + $doc = New-Object HtmlAgilityPack.HtmlDocument
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
    + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

    ReplyDelete
    Replies
    1. Houstonsolo - That error looks like the script wasn't able to access htmlagilitypack.dll for some reason. Make sure you have downloaded the html agility pack and extracted the appropriate dll file into the same directory as the script, and that you are in that directory when you run the script. In my post with step by step instructions, I used "c:\temp" as the working directory for this.

      Delete
  4. I know this is old, but maybe you are still monitoring. This script looks exactly like what I need, so thanks for sharing. I'm having a problem that may be outside your realm. Anyway, I abandoned windows a long time ago, but I'm not any kind of linux expert. I'm trying this on Linux Mint. I have Powershell core v. 6.2.2 installed and working. I have the GV archive, the script, the agility pack and the .dll. But I'm getting a lot of errors, almost all like:

    You cannot call a method on a null-valued expression.
    At /home/jeff/Documents/googlevoice/import-gvhistory.ps1:117 char:21
    + ... $Duration = $doc.documentnode.selectnodes(".//abbr[@class ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    But also one:

    Sort : The term 'Sort' is not recognized as the name of a cmdlet, function, script file, or operable program.
    Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At /home/jeff/Documents/googlevoice/import-gvhistory.ps1:209 char:22
    + $GVHistory | Sort Time
    + ~~~~
    + CategoryInfo : ObjectNotFound: (Sort:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


    Is this just what I get for trying to run a windows powershell script on linux when I don't really know what I'm doing? Or is there some way around this?
    Thanks so much!

    ReplyDelete
  5. I know this code is really old, but thanks for putting it together. I had to change the Get Date function, but after that it worked like a charm.

    ReplyDelete
    Replies
    1. Hi I would really appreciate the update you made to the Get Date function. Could you kindly share the updated script with me? My email is malik@theteleworksolution.com

      Delete

Post a Comment

Popular posts from this blog

Windows 10 Credential Guard breaks WiFi

Mystery Solved: Bitlocker is enabled, but Intune shows the computer as non-compliant for Require Bitlocker

Data Sharing Service crashes on Windows Server 2016 - Event ID 7023