The following code will read Excel sheet and print it to console, i want to read excel values and store in to Database.
Can you give me logic to read cells and store in to DB
Rajendra Prakash wrote:Can you give me logic to read cells and store in to DB
No it doesn't work that way. What have you tried? What went wrong? What happened and what did you expect to happen?
And moving to Java in General.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Rajendra Prakash
Ranch Hand
Joined: Sep 10, 2009
Posts: 293
posted
0
From Excel sheet i read all the fields as string . In that date field is there , i am getting "dd/mm/yyyy" format.
But i want to convert this to "yyyy/mm/dd". i have tried with SimpleDateFormat class. But i could not get.
can you help me
amit punekar
Ranch Hand
Joined: May 14, 2004
Posts: 488
posted
0
Hi,
Why did SimpleDateFormate not work? Did it throw any exception or did not convert the date in the format you needed.
Let us know.
regds,
Amit
Rajendra Prakash
Ranch Hand
Joined: Sep 10, 2009
Posts: 293
posted
0
with the following code i can read multiple excel files in a single workbook and store in to database. Now
i want to read multiple workbooks and store in to db. can you give me any logic for this.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
Now i want to read multiple workbooks and store in to db. can you give me any logic for this.
There is a method that reads one file and stores something to the database - it sounds as if calling that method multiple times with different files would do the trick. Have you tried that? If so, what was the result? If not, tell us where you are stuck making progress.
No am not clear what you say. consider two folders , each consists one workbook . i want to read both workbooks and store in to db
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
Well, the "first" method reads one file and stores it to the DB, no? What is the problem with calling xlreader.first(..) repeatedly with different filenames?
Rajendra Prakash
Ranch Hand
Joined: Sep 10, 2009
Posts: 293
posted
0
yes , it is working fine. Now user can select workbook dynamically means , what i can do.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
I don't follow - what difference does it make whether the user selects the file, or if the filename is hardcoded? The Excel/DB part would be the same, no?
If you're asking something else, TellTheDetails. Your last two posts were very short, so it's hard to know what you have, and what problems you're encountering.
Rajendra Prakash
Ranch Hand
Joined: Sep 10, 2009
Posts: 293
posted
0
consider i have a folder prakash,inside that i would like to find all excel files . Once i found all excel files i have read the same and store in to db
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
OK, that's not hard. What do you have so far, and where are you stuck making progress? Are you familiar with the java.io package, particularly the File class and its methods? If not, that's where you should start.
Rajendra Prakash
Ranch Hand
Joined: Sep 10, 2009
Posts: 293
posted
0
with the following code i can read multiple excel files. but now i want to read multiple excel files from single folder in
a single line. i dont want to call "first" method again and again. which means i want call excel file dynamically
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
but now i want to read multiple excel files from single folder in a single line. i dont want to call "first" method again and again. which means i want call excel file dynamically.
Create a method that takes the name of the directory as parameter, and in that method iterate through all files in that directory. For each xls file you'd then call the first method.
Rajendra Prakash
Ranch Hand
Joined: Sep 10, 2009
Posts: 293
posted
0
consider i have some 3 or 4 excel files.I dont know that files names , how can i read all files one by one
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
1
The java.io.File class has methods for enumerating all files in a directory. You can then check their names in a loop, and only process those with appropriate file names (like with an "xls" extension).
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Read Excel values and store in to Database