How to export iMessages to CSV or Excel on a Mac, 3 ways.
A spreadsheet of your texts is handy for a case, an expense claim, research or just counting who texts more. Messages can't make one, but your Mac can, for free, if you don't mind Terminal.
Quick answer
Messages has no CSV or Excel export. The free way is to copy the Messages database and export a conversation with the sqlite3 tool built into macOS, which writes a CSV file that opens in Excel or Numbers. For a chat with years of history, or if you'd rather not use Terminal, an export app is faster.
| Way | Best for | Catch |
|---|---|---|
| sqlite3 in Terminal | Free, any conversation on your Mac | Technical. Some messages come out blank on recent macOS. |
| iPhone backup tools | Texts that are only on an iPhone, or Windows | Paid. You make a backup first. |
| Textlore | A chat, a date range or a few messages, in a few clicks | Paid app after a 14-day free trial. |
1. Export a conversation to CSV with sqlite3
Messages stores your history in a database file, chat.db, in your Library folder. macOS includes sqlite3, a tool that can read it and write the results as CSV. You'll paste 3 commands.
- Open System Settings > Privacy & Security > Full Disk Access and switch on Terminal. macOS protects the Messages folder, and Terminal can't read it without this.
- Open Terminal and paste this, so you work on a copy and never on the live file:
mkdir -p ~/Desktop/messages-copy && cp ~/Library/Messages/chat.db* ~/Desktop/messages-copy/
- List your conversations. For a one-to-one chat the identifier is the phone number or email. Group chats show the name you gave them in the display_name column.
sqlite3 -header ~/Desktop/messages-copy/chat.db "SELECT chat_identifier, display_name FROM chat;"
- Paste this, with
+15551234567replaced by the identifier from the last step. It writesmessages.csvto your desktop with the date and time, who sent each message, and the text.
sqlite3 -header -csv ~/Desktop/messages-copy/chat.db "SELECT datetime(m.date/1000000000 + 978307200, 'unixepoch', 'localtime') AS sent, CASE m.is_from_me WHEN 1 THEN 'Me' ELSE h.id END AS sender, m.text FROM message m JOIN chat_message_join cm ON cm.message_id = m.ROWID JOIN chat c ON c.ROWID = cm.chat_id LEFT JOIN handle h ON h.ROWID = m.handle_id WHERE c.chat_identifier = '+15551234567' ORDER BY m.date;" > ~/Desktop/messages.csv
- Double-click
messages.csvto open it in Numbers, or open it from Excel. Delete themessages-copyfolder when you're done, since it holds your whole history.
Where it falls short
- Some rows have no text. On recent versions of macOS, many messages keep their text in a coded column instead of the plain text one, so those rows come out blank.
- Numbers, not names. The sender column shows phone numbers and emails, not the names in your Contacts.
- No attachments. Photos and files aren't in the CSV, and reactions show up as their own rows.
- Easy to get wrong. One missing quote mark and the command fails, and the date maths is easy to break if you edit it.
2. Use an app that reads iPhone backups
If your texts are only on your iPhone, or you use Windows, apps that read iPhone backups can export them as a spreadsheet. iMazing exports messages to Excel and CSV, and Decipher TextMessage exports CSV. Both are paid and run on Mac and Windows.
- Install the app and connect your iPhone. Let the app make or read a backup of the phone.
- Open the messages section in the app and choose the conversation.
- Choose the CSV or Excel export and save the file.
The free command-line tool imessage-exporter reads backups too, but it exports text and HTML files, not CSV.
3. Export to CSV with Textlore
Textlore is a Mac app that reads your whole Messages history and exports any conversation, date range or set of messages as a CSV file. There's no Terminal and no backup to make. It only reads: it never sends, edits or deletes a message, and nothing leaves your Mac.
- Install it. Download Textlore, open it and switch on Full Disk Access when it asks. macOS keeps your Messages history in a protected folder, and this lets Textlore read it. About 100,000 messages import in under a minute.
- Pick what to export. Open a conversation and press ⇧⌘E for the whole chat, or choose a date range. For a few messages, click Select, pick them (Shift-click picks everything in between) and press ⌘E.


- Choose CSV and export. Pick CSV as the format, check the preview and export. Textlore shows the finished file with buttons to Share, Show in Finder or Open it.
- Open it in Numbers or Excel. Each message is its own row, ready to sort, filter or count.
Use search first if you only want some messages. Search words such as from:Jordan, has:link or after:march 2024 find them across every chat, and Return opens the conversation at that message, ready to select.
The same export saves PDF, HTML, plain text, Markdown or an image. See Export in Help for every option.
Questions
Can I export iMessages to Excel for free?
Yes, with sqlite3 in Terminal, which comes with macOS. It writes a CSV file that Excel and Numbers open. It takes some care, and on recent macOS some messages come out without their text.
Why are some messages blank in my CSV?
Newer versions of macOS keep the text of many messages in a coded column of the database instead of the plain text column. A simple sqlite3 query only reads the plain column, so those rows are empty. Export apps decode both.
Can I export iMessages from my iPhone to Excel?
Switch on Messages in iCloud so your iPhone texts are on your Mac, then use any method on this page. Or use an app that reads iPhone backups, such as iMazing.
Can I export a group chat to CSV?
Yes. In sqlite3, use the group's chat_identifier from the list of conversations. In Textlore, open the group and export it like any other conversation.
Does exporting change anything in Messages?
No. sqlite3 reads a copy of the database, and Textlore only reads too. It never sends, edits or deletes a message, and nothing is uploaded.
Your texts, in a spreadsheet.
Download Textlore and export your first conversation to CSV. Free for 14 days.