Skip to Content
0
Former Member
Jun 08, 2009 at 03:35 AM

problem reading a excel(csv) file in dynpage or abstract portal component

32 Views

Hi all,

Below is the code for reading a xcel file..It works simply as a java application,But its not working in abstract portal component or a dynpage... plz tel me the solution.. the problem is i am unable to read the contents of excel file..

File file = new File("C:
Documents and Settings
Sowmya_B04
Desktop
example.csv");

BufferedReader bufRdr = new BufferedReader(new FileReader(file));

String line = null;

int row = 0;

int col = 0;

// read each line of text file

while((line = bufRdr.readLine()) != null)

{

StringTokenizer st = new StringTokenizer(line,",");

while (st.hasMoreTokens())

{

//get next token and store it in the array

numbers[row][col] = st.nextToken();

col++;

}

row++;

response.write("content:"+numbers[row][col]);

}

// close the file

bufRdr.close();

}

Thanks in advance

Regards,

Sowmya B