Export Chrome History as CSV (Spreadsheet)

Chrome stores history as an SQLITE3 database.

First, find it.
Close Chrome.

Open up the terminal, and navigate to the directory that contains the History file.

cd ~/Library/Application\ Support/Google/Chrome/Default/

Open the database with SQLITE3:

sqlite3 History

Enable Sqlite3 output mode as CSV by typing into sqlite shell:

sqlite> .headers on
sqlite> .mode csv
sqlite> .output my-chrome-output.csv

Now, execute the SQL statement (copy and paste). Note that by default, the time stamp is not “human readable” so we’ll insert some logic to convert times into our local time zone / months, years, and that good stuff.

SELECT datetime(last_visit_time/1000000-11644473600,'unixepoch','localtime'),
                        url 
                 FROM urls
                 ORDER BY last_visit_time DESC

Done! Check your directory for my-chrome-output.csv.

Why this isn’t documented anywhere except in small pieces? Don’t know.

14 Comments

  1. cgenco says:

    I just made a chrome extension that lets you export your entire Chrome history as a csv Excel-readable spreadsheet and json: https://chrome.google.com/webstore/detail/hcohnnbbiggngobheobhdipbgmcbelhh/publish-accepted

    1. Barry says:

      This is awesome except for the LastTimeVisited.

      For Aug 24, 2014 @ 12:20:xx it lists a value of 1408900847799.88 how do I get this date time format from what ever it’s stored as to a date/time format that I can understand.

  2. Yuji says:

    Very nice. I needed this earlier… !

  3. Christine says:

    Your extension only works for the 90 day window, not for archived history (beyond 90 days)

  4. Stanza_Hub says:

    Thank you, the SQL statement was very helpful.

  5. modle13 says:

    Thanks! Note: I found the database on Linux Cinnamon Mint 18 here: ~/.config/google-chrome/Default/History

  6. jamiejbrowning says:

    You are missing a semi colon at the end of your Query

  7. jamiejbrowning says:

    I am on MAC and getting “database is locked” error.

    1. Tdm says:

      Quit your browser and try again.

  8. KA CHUN LUK says:

    work like a charm!!!! thanks may I know how you discover this method, have you read the source code of chromium or something like that

Leave a Comment