User Oracle Generic connectivity to connect excel using ODBC. See the link below
Worked example for using Excel through ODBC
http://asktom.oracle.com/p
Main Topics
Browse All TopicsI need to read excel file using PL/SQL, please provide step by step procedure.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
User Oracle Generic connectivity to connect excel using ODBC. See the link below
Worked example for using Excel through ODBC
http://asktom.oracle.com/p
A good way to read/write/control Miscrosoft office apps is through the OLE system.
You can create a PLL that can be attached to any form that you need to work with Excel.
The PLL should consist of a pl/sql package:
The package spec:
PACKAGE excel IS
-- global variables (constants)
application ole2.obj_type;
workbooks ole2.obj_type;
workbook ole2.obj_type;
worksheets ole2.obj_type;
worksheet ole2.obj_type;
procedure open_excel;
procedure close_excel;
procedure read_num_cell( p_row number, p_col number, p_value in out number );
procedure read_chr_cell( p_row number, p_col number, p_value in out varchar2 );
procedure open_workbook;
procedure close_workbook;
procedure open_excel_doc( p_pateka varchar2 );
procedure close_excel_doc;
procedure activate_sheet( p_redosled integer );
end;
PACKAGE BODY excel IS
procedure open_excel is
begin
application := ole2.create_obj('Excel.App
end;
procedure close_excel is
begin
if worksheet is not null then
ole2.release_obj(worksheet
end if;
if worksheets is not null then
ole2.release_obj(worksheet
end if;
if workbook is not null then
ole2.release_obj(workbook)
end if;
if workbooks is not null then
ole2.release_obj(workbooks
end if;
if application is not null then
ole2.release_obj(applicati
end if;
end;
procedure read_num_cell( p_row number, p_col number, p_value in out number ) is
args ole2.list_type;
cell ole2.obj_type;
begin
args := ole2.create_arglist;
ole2.add_arg(args, p_row );
ole2.add_arg(args, p_cel );
cell := ole2.get_obj_property(work
ole2.destroy_arglist(args)
p_value := ole2.get_num_property(cell
ole2.release_obj(cell);
end;
procedure read_chr_cell( p_row number, p_col number, p_value in out varchar2 ) is
args ole2.list_type;
cell ole2.obj_type;
begin
args := ole2.create_arglist;
ole2.add_arg(args, p_row );
ole2.add_arg(args, p_col );
cell := ole2.get_obj_property(work
ole2.destroy_arglist(args)
p_value := ole2.get_char_property(cel
ole2.release_obj(cell);
end;
procedure open_workbook is
begin
workbooks := ole2.get_obj_property(appl
end;
procedure close_workbook is
begin
ole2.invoke(workbooks,'Clo
end;
procedure open_excel_doc( p_pateka varchar2 ) is
args ole2.list_type;
begin
args := ole2.create_arglist;
ole2.add_arg(args, p_pateka );
workbook := ole2.invoke_obj(workbooks,
ole2.destroy_arglist(args)
worksheets := ole2.get_obj_property (workbook,'Worksheets');
end;
procedure close_excel_doc is
begin
ole2.invoke(workbook, 'Close');
end;
procedure activate_sheet( p_redosled integer ) is
args ole2.list_type;
begin
args := ole2.create_arglist;
ole2.add_arg(args, p_redosled );
worksheet := ole2.get_obj_property(work
ole2.destroy_arglist(args)
ole2.invoke( worksheet, 'Activate');
end;
end;
THEN attach the PLL to the form and IN THE MAIN PROCEDURE in the form:
declare
p_value number := 4;
begin
EXCEL.open_excel;
EXCEL.open_workbook;
EXCEL.open_excel_doc('c:\a
EXCEL.activate_sheet(1); -- 1 is the first worksheet from left
EXCEL.READ_NUM_CELL(1, 1, p_value);
-- do what is needed with the p_value
EXCEL.close_excel_doc;
EXCEL.close_workbook;
EXCEL.close_excel;
end;
Hello,
I need a pure pl/sal code that can read from xls sheet as table i want to update 5 oracle tables from
this excel sheet
question do you to load this xls sheet to a templ table and do my business logic on it?
or can i deal with excel sheet as an oracle table ie reading from it using sql statment?
is this doable?
please help how i can do that?
Business Accounts
Answer for Membership
by: sathyagiriPosted on 2006-07-12 at 19:43:17ID: 17096375
You can use UTL_FILE to do this.
','fname.c sv','R',50 00); dle,v_stri ng); _string,', ',1,1)-1); instr(v_string,',',1,2) - instr(v_string,',',1,1) -1); de||sqlerr m);
here's a sample
create or replace procedure proc1
is
file_handle utl_file.file_type;
var1 table1.col1%type;
var2 table1.col2%type;
v_string varchar2(1000);
file_handle := UTL_FILE.FOPEN('/directory
begin
loop
begin
UTL_FILE.get_line(file_han
var1 := susbstr(v_string,1,instr(v
var2 := substr(v_string, instr(v_string,',',1,1)+1,
insert into table1 (col1,col2) values (var1,var2);
exception
when no_data_found then
UTL_FILE.fclose (file_handle);
exit;
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(sqlco
end;
end loop;
commit;
end;