Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1559
  • Last Modified:

From Oracle pl/sql open Excel spreadsheet, run a macro, save the spreadsheet

From an Oracle database (11.2 in my case) and not from an Oracle Form, execute a pl/sql procedure to

1.  Open an Excel Spreadsheet
2.  Run a macro staored on that spreadsheet
3.  Save the Spreadsheet

I'm also presently looking at open source products and I see information online about doing this from an Oracle Form but not much from just a pl/sql procedure.
  • 2
1 Solution
if your database is remote and your spreadsheet is local,  then you can't do it.   pl/sql runs on the db and has no access to anything that isn't on that server.

if your database is local to the file, then you could do it with an external procedure call,
or presumedly this would be a windows server, you could try a .net stored procedure that invokes excel
or, you could try using dbms_scheduler to invoke excel as an external program

as for the macro,  excel will have to do that itself.  pl/sql has no means of executing anything within excel
talahiAuthor Commented:
Excel and db are local.

I've seen pl/sql code in a forum using the type  ole2.obj_type and believe that only relates when using Oracle Forms and
OLE2.ADD_ARG(args, 'ExactNameOfTheMacro');
to run an Excel Macro.  So am I correct in assuming this this can't be used on the db using plsql?

p_file_name in varchar2,
p_sheet_name in varchar2,
p_range in varchar2,
p_from_row in number,
p_from_col in number,
p_to_row in number,
p_to_col in number,
p_value out varchar

-- Declare handles to OLE objects
application ole2.obj_type;
workbooks ole2.obj_type;
workbook ole2.obj_type;
worksheet ole2.obj_type;
cell ole2.obj_type;
cell1 ole2.obj_type;
correct,  server side pl/sql  can't use ole2 library,  that's forms specific functionality

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now