Exporting Macros to CSV Script

Last Updated -

Overview

Here, we'll show you how to connect to a Desk.com account and export all macros to a comma-separated value (CSV) file. This is a great way to audit macros for organizational and clean up purposes.

Requirements

Before proceeding with this article, it should be noted that you would need some programming proficiency and experience so a developer may be required.

This script is written in Ruby and requires at least version 2.3.0, or above. To check which version of Ruby you have installed, simply run ruby -v in a terminal.

If you have an older version installed, it's very easy to upgrade and manage different versions with the Ruby Version Manager (RVM). Please see the RVM website for installation instructions.

Note: Using RVM to manage your Ruby installations is highly recommended.

Installation

  1. Download the sample code at: https://desk-wow.s3.amazonaws.com/services/Macro-to-CSV.zip

  2. Navigate to the folder (for example using cd ~/Desktop/Macro-to-CSV  in a terminal and run these commands:

  3. gem install bundler

  4. bundle install

  5. cp .env.example .env

  6. Edit .env to include your credentials. nano .env
    To save the file, use Control X, and then hit Y for Yes.

Usage

Now run the following:

ruby macro_to_csv.rb

You will see a progress bar while this is running.

A CSV file will be created with the format: domain_desk_com-macros-YY_MM_DD.csv in the directory of Macro-to-CSV .

You're done!