Reputation: 193
This is the first time that I am attempting this, and I don't know if it is possible. I am trying to develop an application that allows me to upload an excel file directly into a database.
Is it possible to upload the excel data without first converting the excel sheet to the CSV format? The database table contains fields and columns with the same names as the excel file.
Does anyone know of a tool which can do this for me?
Upvotes: 1
Views: 244
Reputation: 186
it is certainly possible. You might be interested in the JBoss Teiid project, which enables accessing Excel spreadsheet like it was a table.
Given that, you can then easily fill all the values from a "virtual" table formed from the spreadsheet (let's call it excelTable) into another table (let's call it targetTable):
INSERT INTO targetTable(column1,...) SELECT column1,... FROM excelTable;
The project is open-source so if its usage doesn't fit your needs, you can always look at the sources and maybe get an inspiration, how you can do such things.
Best regards
Jan
Upvotes: 3
Reputation: 1583
For Oracle, the easiest way is to use sqlldr
for bulk load.
So you need an application that will parse the xls/xlsx
and write a data file for sqlldr
(can be csv
, in fact any delimited text file).
If you really don't want to convert the file you could parse it and insert each row at a time, but this method is very slow when dealing with a lot of data.
EDIT: Equivalent tool for sqlserver
is called BCP
And of course, you can use the tools withouth any software attached, running them via command lines once you have the data and/or control files ready.
Upvotes: 0