In this article, let’s see how to export GitHub issues to a CSV file using the Git CLI.
The steps I am going to show you are tailored for a Windows machine, but the steps for non-Windows machines are mostly the same. I will also share the official documentation link in case you encounter any issues.
Lets get started with the steps.
Install the GitHub CLI:
- Refer to this documentation for steps to install CLI on various OS. Since I’m using Windows OS, if you’re a Windows user, follow along.
- Open the command prompt and execute following command:
winget install --id GitHub.cli

- Note : Make sure you close and open the terminal again. Simply opening a new tab will not be sufficient.
After installing the CLI, the next step is to complete authentication.
Authenticate with GitHub account:
- Execute the following command to start the authentication process.
gh auth login
- Select the options and keep pressing Enter button.
- You will be presented with a one-time code.
- Press Enter again, which will open a browser window asking for the code.

- Enter the code copied from the command prompt, and then press Continue

- In the next screen, click on Authorize github

- You will be redirected to the following success screen.

- Go back to the command bar, and you will see the message as below.

Now that we have completed the authentication, we can proceed with exporting issues to CSV.
Export the issues to csv:
- Open the official documentation to understand the syntax of gh issue list command, where you can apply filters to narrow down the list.

- In my scenario, I want to export all the issues with the ‘Documentation’ label. Hence, I executed the following command:
gh issue list --label "documentation" -R <github_project-name> --limit 1000
- Note : If you don’t provide –limit, by default you get only 30 items.
- The above command will fetch and display the list of issues within the command prompt, as shown below.

- To store the list in a CSV file, execute the following command:
gh issue list --label "documentation" -R microsoft/coe-starter-kit --limit 1000 > Documentation_Issues.csv

- A CSV file with the list of issues is generated in the command execution path.
Hope you understand the steps to download the issues using the GitHub CLI.
🙂

![[Step by Step] Configure and consume 'Environment Variables' of type 'Secret' using 'Azure Key vault'](https://rajeevpentyala.com/wp-content/uploads/2023/05/image.png)
Leave a comment