Exporting GitHub issues to Excel is way more challenging than it should be.

In the past, prior to two factor authentication, you could use curl with your username and password to return JSON.

curl -i "https://api.github.com/repos/{repo_name}/{project_name}/issues" -u "{user_name}"

Unfortunately, you need two factor authentication. All of our orgs at AllCode require two factor authentication.

For querying GitHub’s REST API with two factor authentication, your best solution is to make use of a Personal Access Token, but in order for the Personal Access Token to work, your app needs to be a GitHub App or OAuth App. None of our repos are.

So how do you dump all of your GitHub Issues to Excel so you can share the issues with the client. The answer is you make use of the hub command line utility. To get started,

  1. Clone the repo from GitHub into your working directory.
  2. Install hub (e.g. on macOS run: brew install hub).
  3. Run: hub issue in your repo directory to list the open issues (it’s in Markdown format).
  4. If you have two factor authentication turned on, you’ll be prompted for username, password, and two factor authentication code. Supply the appropriate information
  5. Run hub issue -f "Issue|%I%nTitle|%t%nBody|%b%n%n" > GitHubIssues-01032019.txt

Details on this formatting are here.

-f, –format FORMAT

Pretty print the contents of the issues using format FORMAT (default: “%sC%>(8)%i%Creset %t% l%n”). See the “PRETTY FORMATS” section of git-log(1) for some additional details on how placeholders are used in format. The available placeholders for issues are:

%I: issue number

%t: title

%b: body

Hub Issue Formatting can be found here.

This command will generate a pipe delimited text file with the main attributes on the first line, and the body on 2 through n lines. The body of our issues are typically verbose.

Now open your GitHubIssues-01032019.txt file in Excel. Specify the pipe as the delimiter and you’re good to go.

Export GitHub Issues to Excel

Export GitHub Issues to Excel