I mentioned in a recent post that I was looking to automate the production of some Excel workbooks from an Oracle Database. I think I finally hit upon a solution that might get approved for use. The answer might well be the xlsx builder package.
There are some useful comments here:
https://technology.amis.nl/languages/oracle-plsql/create-an-excel-file-with-plsql/
I was keen to give the package a go so compiled it on my home laptop. The only extra config that was required was setting up a file directory, a quick Google sorted that along with knowing I needed to call this in caps.
Once compiled it was simply a case of calling the package. There is no real documentation that I could find however producing basic extracts was easy.
begin | |
as_xlsx.clear_workbook; | |
as_xlsx.new_sheet( 'query 1' ); | |
as_xlsx.query2sheet( 'select * from cast_dim', p_sheet => 1 ); | |
as_xlsx.new_sheet( 'query 2' ); | |
as_xlsx.query2sheet( 'select * from director_dim', p_sheet => 2 ) ; | |
as_xlsx.save('TEST_FILES', 'my2.xlsx' ); | |
end; |
This produced a nice spreadsheet as shown below.
No comments:
Post a Comment