DEV Community

Cover image for Created a CLI tool to backup Slack export data in Excel
Yuki Shindo
Yuki Shindo

Posted on

Created a CLI tool to backup Slack export data in Excel

Starting September 1, 2022, the retention period for messages in Slack will be limited to 90 days.
https://slack.com/blog/news/pricing-and-plan-updates

I had been using Slack with my family on a free plan, but decided to back these up because message exchanges prior to 90 days would be lost.

There was a way to use the Slack API, but this time decided to use exported data that can be downloaded from the Slack GUI.
(Since it is not via the API, it does not seem feasible to do something like automatic backups on a regular monthly basis, but oh well.)
I chose Go as our language because wanted to learn Go.

Here is the actual CLI tool created.

https://github.com/shinshin86/slack-export-data-to-excel

(Oh, the package name is not Go-like...😅)

Installation is done with the following command.
(It is assumed that Go is installed on your machine)

go install github.com/shinshin86/slack-export-data-to-excel@latest
Enter fullscreen mode Exit fullscreen mode

How to backup slack export data

Follow the documentation below to download the Slack export data.
https://slack.com/help/articles/201658943-Export-your-workspace-data

Next, unzip it in an appropriate directory and run the following command to generate an Excel file based on the exported data.
Enter the directory of the exported data in the <export data path> field.

slack-export-data-to-excel <export data path>
Enter fullscreen mode Exit fullscreen mode

Since backups are generated based solely on Slack export data, data not included in the export data will naturally not be backed up.
For example, private messages and DMs cannot be backed up.

PR is welcome!

As you can see from the repository, I am still new to writing Go.
If you have a trick to make it better, please send me a PR.

Top comments (0)