Exporting Skype Chat/Skype Contacts to csv file using the shell script and sqlite3 (usually already installed on mac)
Edit: a very first draft version of Skype Exporter have been made and released.
https://github.com/renesto/SkypeExportSwift/releases
check it, and report any issues to renesto-at-gmail.com
I heard there are not so many nice ways to get the chat history from skype, so I came across a page of one guy who shows a way to open the sql chat history database and delete all conversations. I thought to make something more from that idea (as delete chat history is now one of the options in skype)
Create a file exportFromSkype.sh
place either this text:
https://github.com/renesto/SkypeExportSwift/releases
check it, and report any issues to renesto-at-gmail.com
I heard there are not so many nice ways to get the chat history from skype, so I came across a page of one guy who shows a way to open the sql chat history database and delete all conversations. I thought to make something more from that idea (as delete chat history is now one of the options in skype)
Create a file exportFromSkype.sh
place either this text:
sqlite3 -batch "$HOME/Library/Application Support/Skype/$1/main.db" <<EOF
.mode csv
.output $2.csv
select * from Messages where dialog_partner = '$2';
.output stdout
.exit
EOF
chmod +x exportFromSkype.shnow, when you want to export some chat history from certain person, you can do it by:
sh exportFromSkype.sh your_skype_name your_friends_skype_name
and it will create a csv file with name persons_skype_name.csv in the same folder where the script is placed.
You can also modify the script, and use for example as a sql query other tables, like:
sqlite3 -batch "$HOME/Library/Application Support/Skype/$1/main.db" <<EOFThis will give you whole list of Contacts in csv file. when you run it as:
.mode csv
.output contacts.csv
select * from Contacts;
.output stdout
.exit
EOF
sh exportFromSkype.sh your_skype_name
A bit more step-by-step instruction I wrote in this post
Edit: In case you want to get the exact time-date export, I suggest changing the "select ..." line with the following one:
select author,dialog_partner,datetime(timestamp, 'unixepoch', 'localtime'),body_xml from Messages where dialog_partner = '$2';Edit: Edit: Thanks to Bob for discovering incomplete query, I tried to fix it now.
select author, datetime(timestamp, 'unixepoch', 'localtime'), edited_timestamp, body_xml from Messages where convo_id in (select id from Conversations where identity = '$2');
Comments
Exactly what I was looking for. Simple & efficient for automating backups.
Thank you for writing this and the instructions on the Skype forums. I've got all my chat histories exported to .csv files now but was wondering if you could help me with one other thing.
Looking at the files I can't identify which column is the time stamp, nor what format that time stamp is in. I wanted to figure that out so I could make a new column with the exported time stamp formatted (or converted) to date/month/year HH:MM:SS.
Any help you can offer would be most appreciated!
Thanks!
Dawn
(sorry for deleted/double post, blogger edit button eludes me if it's there.)
I have updated my blog post, with the different line which would give you better generated table, with only useful columns, and also properly created date and time.
You need to replace the line that starts with "select ..." with the line I wrote at the end of the blog post.
In these Skype tables, Time is defined as a unix epoch, which counts the amount of seconds since 1970-01-01 00:00:00.
Text Edit won't let me save the .sh file without adding .rtf on the end. I tried other formats but it won't work with them either. I can't get terminal to run it with the .rtf at the end and no matter how I try it (.sh in the command or .sh.rtf it says no directory found or some such thing. Any ideas?
Can you try in TextEdit the following:
- Before you save your document, select Make Plain Text from the Format menu. (If the menu says Make Rich Text then you are already in plain text mode.)
I found this solution on a answer to question on this
forum .
Maybe this helps!
As I can't get past this step I can't see if the text editor changes will work.
Error: near line 1: near ".": syntax error
Error: incomplete SQL: .output stdout
.exit
EOF
I read and tried ALL the solutions to the chmod step from this thread: Sublime instead of TextEdit; no hidden rtf. extensions; no hidden spaces; etc.
Still it always says in Terminal, when I run the chmod command, "chmod: exportFromSkype.sh: No such file or directory"
HELP!
Thanks
Error: near line 1: near ".": syntax error
Error: incomplete SQL: .output stdout
.exit
EOF