How can I export GitHub issues to Excel?

微笑、不失礼 提交于 2019-11-28 04:59:47

To export from a private repo using curl, you can run the following:

curl -i "https://api.github.com/repos/<repo-owner>/<repo-name>/issues" -u "<user-name>"

Where the user has access to the private repo. You can then convert the resulting json into csv using any suitable converter as suggested in other answers.

Find authentication reference here.

If that is a one-time task, you may play around with GitHub WebAPI. It allows to export the issues in JSON format. Then you can convert it to Excel (e.g. using some online converter).

Just open the following URL in a browser substituting the {owner} and {repo} with real values:

https://api.github.com/repos/{owner}/{repo}/issues?page=1&per_page=100

I tried the methods described in other comments regarding exporting issues in JSON format. It worked ok but the formatting was somehow screwed up. Then I found in Excel help that it is able to access APIs directly and load the data from the JSON response neatly into my Excel sheets.

The Google terms I used to find the help I needed were "excel power query web.content GET json". I found a How To Excel video which helped a lot.

URL that worked in the Excel query (same as from other posts):

https://api.github.com/repos/{owner}/{repo}/issues?page=1&per_page=100

Personally, I also add the parameter &state=open, otherwise I need to request hundreds of pages. At one point I reached GitHub's limit on unauthenticated API calls/hour for my IP address.

It is unfortunate that github.com does not make this easier.

In the mean time, if you have jq and curl, you can do this in two lines using something like the following example that outputs issue number, title and labels (tags) and works for private repos as well (if you don't want to filter by label, just remove the labels={label}& part of the url). You'll need to substitute owner, repo, label, and username:

echo "number, title,tags" > issues.csv
curl "https://api.github.com/repos/{owner}/{repo}/issues?labels={label}&page=1&per_page=100" -u "username" \
| jq -r '.[] | [.number, .title, (.labels|map(.name)|join("/"))]|@csv' >> issues.csv

Note that if your data exceeds 1 page, it may require additional calls

Export Pull Requests can export issues to a CSV file, which can be opened with Excel. It also supports GitLab and Bitbucket.

From its documentation:

Export open PRs and issues in sshaw/git-link and sshaw/itunes_store_transporter:

epr sshaw/git-link sshaw/itunes_store_transporter > pr.csv

Export open pull request not created by sshaw in padrino/padrino-framework:

epr -x pr -c '!sshaw' padrino/padrino-framework > pr.csv

It has several options for filtering what gets exported.

The hub command-line wrapper for github makes this pretty simple.

You can do something like this:

$ hub issue -f "%t,%l%n" > list.csv

which gives you something like this

$ more issue.csv

Issue 1 title, tag1 tag2
Issue 2 title, tag3 tag2
Issue 3 title, tag1
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!