Home > other >  Having problems while writing a .CSV file in Java?
Having problems while writing a .CSV file in Java?

Time:09-25

So, I'm trying to realize a program that downloads all the Issues from a GitHub repository and stores their IDs and their Bodies into a .CSV file. This is what I wrote and kinda works (it downloads the issues):

        FileWriter writer = new FileWriter("ISSUE-DOWNLOAD.csv");
        writer.append("Id \t Body Text");
        writer.append("\n");

        for (GHIssue issue : repository.getIssues(stateOpen)) {
            String body = issue.getBody(); 
            if( body!=null ) 
            {   
                writer.append(issue.getNumber()   "\t");
                writer.append(body   "\t");
            }
            writer.append("\n");
        }

enter image description here

with your expected result

enter image description here

all fields (numbers, strings, dates and long string like body) have been imported.

  • Related