0

I am trying to parse this xls file:

http://web.iyte.edu.tr/sks/xls/Agustos_Menu_2012.xls

Orange places have date and belove those dates there are food list of that day. So can you please suggest me a way to parse that to get dates and foods? I tried to convert that xls to comma seperated value but some characters are changing and i don't know how to get dates and foods into an array or a file in an organized way in order to use later.Thanks.

Figen Güngör
  • 10,407
  • 11
  • 56
  • 101
  • 2
    Have you checked this question http://stackoverflow.com/questions/2942889/reading-parsing-excel-xls-files-with-python which suggests to use http://www.python-excel.org/ – Rohan Aug 25 '12 at 08:56
  • Is that a duplicate for http://stackoverflow.com/questions/2942889/reading-parsing-excel-xls-files-with-python ? – zenpoy Aug 25 '12 at 12:15

3 Answers3

1

For Java language try using API provided by grimholtz and lamber45 -> sourceforge project jexcelapi

The example will be based on the file which contains no. in col B in rows 1(header)-4 To read xls file first import libraries

import java.io.File;
import java.io.IOException;
import jxl.Cell;
import jxl.Sheet;
import jxl.read.biff.BiffException;
import jxl.Workbook;

Rest of the code will be in main() method

public class ReadXLS {
   public static void main(String[] args) throws IOException, BiffException {
   Workbook spreadsheet = Workbook.getWorkbook(new File("example.xls"));
   Sheet myspreadsheet = spreadsheet.getSheet(0); //numbers of spreadsheet starts from 0
   Cell mycell = myspreadsheet.getCell(1, 0);
   String header = mycell.getContents();
   System.out.println(header);
   for(int i=1; i<4; i++){
     mycell = myspreadsheet.getCell(1, i);
     System.out.println(mycell.getContents());
     }
   spreadsheet.close();

   }
}
java_xof
  • 419
  • 4
  • 16
1

Probably the simplest and best option is using the Apache POI - the Java API for Microsoft Documents. It can be found here: http://poi.apache.org/

Peter Isberg
  • 4,582
  • 2
  • 19
  • 32
0

Java: use JExcel API to parse specified document. Here you can find instructions how to use it, focus on Reading spreadsheets section.

Miljen Mikic
  • 13,521
  • 5
  • 51
  • 59