Setup Menus in Admin Panel

Error in read excel function | Selenium Automation | Discussions |

Forum usage guidelines

  1. Search First.: If you don’t find a similar post, start a new topic. If you find a similar thread and still have a question, reply to that topic. Duplicate threads will be ignored/deleted without warning.
  2. Proper Subject: Ensure you choose a very appropriate topic name. Else it will be tough to get support from other members.
  3. Patience, please: Our Tech team or other members will usually try to respond within 24 hours on weekdays and max within 48 hours on weekends. Sometimes sooner.
  4. Share opinions: Please feel free to reply, add or comment on any ongoing topics. Collective learning will be of great benefit to all.

ITeLearn reviews from participants.

Please consider registering

Log In

Lost password?
Advanced Search

— Forum Scope —


— Match —


— Forum Options —


Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Error in read excel function
April 17, 2017
8:57 pm
Abhinaya Abhinaya
Forum Posts: 13
Member Since:
March 28, 2017

Below is the code that i am using and getting an error as” This method must return a result of type string[][]”.

public static String[][] readXL(String fPath, String fSheet) throws Exception{
String[][] xData;

File myxl = new File(fPath);
FileInputStream myStream = new FileInputStream(myxl);
HSSFWorkbook myWB = new HSSFWorkbook(myStream);
HSSFSheet mySheet = myWB.getSheet(fSheet);
System.out.println(“Total rows:”+xRows);
System.out.println(“Total columns:”+xCols);

xData= new String[xRows][xCols];
for (int i=0; i < xRows; i++) {
HSSFRow row=mySheet.getRow(i);
for (int j=0; j<xCols; j++){
HSSFCell cell= row.getCell(j);
String value = "-";
value = cellToString(cell);

return xData;

April 19, 2017
9:37 am
Forum Posts: 1959
Member Since:
October 26, 2012

Use this working code

public static String[][] readXL(String sPath, String iSheet) throws Exception{
String[][] xData;

File myxl = new File(sPath);
FileInputStream myStream = new FileInputStream(myxl);
HSSFWorkbook myWB = new HSSFWorkbook(myStream);
HSSFSheet mySheet = myWB.getSheet(iSheet);
xRows = mySheet.getLastRowNum()+1;
xCols = mySheet.getRow(0).getLastCellNum();
xData = new String[xRows][xCols];
for (int i = 0; i < xRows; i++) {
HSSFRow row = mySheet.getRow(i);
for (int j = 0; j < xCols; j++) {
HSSFCell cell = row.getCell(j);
String value = cellToString(cell);
xData[i][j] = value;
return xData;

Forum Timezone: UTC -8

Most Users Ever Online: 70

Currently Online:
29 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Techhelp: 1959

Manu: 114

Shan Nathan: 80

Palanki sai charan: 67

Userone: 59

Vishal Anand: 53

Archana Sapre: 51

Geetha Reddy: 44

useL: 38

Kavya Vangala: 37

Member Stats:

Guest Posters: 19

Members: 8193

Moderators: 0

Admins: 1

Forum Stats:

Groups: 1

Forums: 22

Topics: 2137

Posts: 5868

Newest Members: Mounika Gulla, Dhananjay More, Sravanthi Matta, Shakthi Kumar, Manisha Bhole, Anand Peddakotla, Ambica Karra, Puja Sharma, Nabin Bhusal, Mostafa Khaled

Administrators: Karthik eLearn (Admin): 49

0 Responses on Discussions"

Main Menu