Skip to content

Instantly share code, notes, and snippets.

Created Feb 18, 2019
What would you like to do?
Converting TextExpander Exports to macOS shortcuts
# Instructions:
# Go to and download all the CSVs into the same directory as this script.
# TextExpander's Export doesn't produce valid CSV files (lol) so make sure to open them with Numbers and re-export them.
require 'csv'
plist = <<~PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
Dir["./*.csv"].each do |filename|
contents =
puts "Opening #{filename}"
csv = CSV.parse(contents)
csv.each do |row|
if row[1].nil?
# Why? We may never know.
puts "Skipping #{row[0]} because its entry is empty."
elsif row[1].include?("<")
# TextExpander has this annoying habit of using HTML for rich text snippts,
# something I never used but managed to worm its way into a few snippets.
# Skip them.
puts "Skipping #{row[0]} entry because it's rich text."
plist += <<~PLIST
plist += <<~PLIST
File.write("output.plist", plist)
puts "Review the output above, and drag output.plist into the System Preferences' Keyboard settings (Text subpanel)."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment