Bulk import WordPress posts into Day One

This export/import process requires bouncing back and forth between the Desktop and iOS versions of Day One as the import/export feature set is very different for each version and you’ll need to leverage both feature sets.

From Desktop Mac:

1.) Open up your Sql client of choice and connect to your WordPress database.

2.) Run this SQL query:

SELECT DATE_FORMAT(post_date, '%Y-%m-%dT%TZ') as 'date', post_content as 'text' FROM wp_9872342423posts where (post_content != '' or post_content is not null);

3.) Open file in a text editor and massage the resulting date to meet the Day One spec (here’s the Day One sample data):

SQL Result: 2023-09-24T13:49:47Z,
Day One: 2016-07-23T22:06:56.000Z,

This date formatting could probably be done in SQL but I got impatient with the syntax.

I did a search and replace ‘Z,’ for ‘.000Z,’

Optionally get rid of html comments, regex for comments is: <!–(.*?)–>

4.) Save this resulting file with a .csv extension somewhere accessible in iCloud


From iPad:
5.) Open iOS version of Day One
6.) Import CSV file (you can’t do this on Desktop version)

Day One will automatically create a new Journal for this import. This behavior is unique to the iOS version! This will just be a temporary journal as you’re going to export, massage and re-import on your Mac.

There may be a bunch of ugly HTML in your entries that you will want to convert to Markdown. The tool that I use for this conversion is Pandoc and as far as I can tell, it is only available from the command line on my Mac so I:

7.) Export a plain text file from Day One on iOS
8.) Save this to iCloud so you can access it from your Desktop


From Desktop:

9.) Fire up a terminal and use Pandoc to fix the html->markdown

cat wp_jw_journal.txt |pandoc -f html -t markdown -o journal.md

My resulting file had a lot of escaped single-ticks so I…

10.) Open up the file in a text editor and replaced the \’ with ‘ in this resulting file.

Also, the Day One export does some line breaking that you may or may not want to correct.

11.) Give the resulting file a .txt ending

THIS IS SO Important: if you don’t want these imported entries to be mixed in with your primary journal, create a NEW JOURNAL and then move it to the top of the journal entries list in the Desktop version settings. Unlike the iOS version of day one, the desktop will not create a new journal for you! Ask me how I know!!

12.) Import the resulting file into the Desktop version of Day One

Posted

in

,