java - Reading in specific lines from an Excel spreadsheet saved as CSV file -
i've got class called temperatureprofile, objects hold 2 attributes:
an array of month names (typestring[]
), and and array of temperatures (type double[]
). now, info these 2 attributes must read excel spreadsheet saved csv file. month names in first column, , temperatures in second.
i'm having problem reading in info these separate columns.
public class temperatureprofile { private double[] temperatures; private string[] monthnames; public temperatureprofile(string filename){ ///read info here, , store result in monthnames , temperatures respectively. } }
public static void main(string[] args) throws ioexception { bufferedreader reader = new bufferedreader(new filereader(new file("f:\\test.csv"))); string line = null; while ((line = reader.readline())!=null){ string[] splitrow = line.split(";"); system.out.println(splitrow[0] + " - "+splitrow[1]); } reader.close(); }
java excel bufferedreader
No comments:
Post a Comment