Thursday, November 16, 2017

HowTo : Backup your texts from Signal Messenger to CSV

I have installed Signal Messenger on my phone after reading news about
it for encrypted communication. But it also "took over" the SMS
business on my phone. So all my SMSes are on Signal now.

I'm living with it for the time being but am open to questioning it
and walking out in the future, with a particular push-out coming from
: the app now and then refusing to let me send out even unencrypted
SMSs unless I update it. (great going, guys! Very whatsappy!)

Another limitation is that it doesn't let me text more that one person
at a time. (seriously?!) Luckily it didn't disable me from sending
texts using the phone's default messenger.

But this post is for a side option: You want to get a backup/copy of
all your texts from Signal messenger as all your SMSes are there.

Well, here's one saving grace : At least you can export messages in
Signal. I can't directly do that in my phone's default SMS app.

Signal has an export feature but it creates an XML file in its own
format which doesn't even validate on most online xml validation
sites, though you can open it in a text editor and see the messages. I
really hate this lets-use-XML-for-everything brigade. If your data is
not hierarchical, CSV is better, folks. Have mercy on others.

So here I'm going to share what I did to get all my texts (SMSes) out
from Signal Messenger to a CSV spreadsheet.

1. In Signal, options/menu > Export/Import > Export

2. It creates a .xml file on your phone. Somewhere. (forgot exactly
where and I promptly moved it to my SD card)

3. Bring that .xml to the laptop/PC. Open it in a text editor that has
Find + Replace.

4. There are XML to CSV converters on the web but they error out
because of the ampersand (&) characters. And there's lots of them,
because Signal html-encodes special characters. Typically, single
quote (') is stored as """, etc.

5. Do Ctrl+H and replace all the &s with tilde, ` (above the left Tab
key). I chose that because that's the only special character which
wasn't used in any of my content.

6. NOW feed it to the converters and they munch it politely. I used
https://onlinexmltools.com/convert-xml-to-csv .

7. Now you have a CSV. With funny HTML codes starting with a tilde (`)
all over the place.

8. Get the CSV into the text editor again. Run Find + Replace again
and change all the Tildes (`) back to Ampersand (&).

9. Go to an HTML Decoder online. I found this and it does the job
client-side, so your data will not go to any other server from your
machine : https://www.opinionatedgeek.com/Codecs/HtmlDecoder

10. Run the CSV output through that. As output you get a CSV with the
data looking more human now. And wow there's line breaks too, but they
don't break the CSV so no worries.

11. Save the CSV data to a local .csv file, open it in LibreOffice
Calc or so. (Not MS Excel? Well, it mishandles csvs often, especially
if there's non-english characters and my texts have some, so.)

12. There, you got all your messages in a nice table that you can sort
by phone number, date etc.

Now, for why didn't I decode the HTML entities first and then convert
to CSV : The dang decoders refused to work with the XML data! And the
XML-to-CSV converters refused to work with XML that had (&) characters
in it, kept saying it was invalid. Hence the roundabout route. Once I
replaced & with ` everyone sang along.

No comments:

Gift Economy

Would you like to show your appreciation for this work through a small contribution?
Contribute

(PS: there's no ads or revenue sources of any kind on this blog)

Related Posts with Thumbnails