Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Export XLSX

Staš ČarfJul 7 2025

Hello!

I'm trying to generate and download an XLSX file, by pressing the button and passing the values of the two page items to the next page where I have a before header process:

DECLARE
    l_ctx    APEX_EXEC.T_CONTEXT;
    l_export APEX_DATA_EXPORT.T_EXPORT;
BEGIN
    l_ctx := APEX_EXEC.OPEN_QUERY_CONTEXT(
        p_location  => APEX_EXEC.c_location_local_db,
        p_sql_query => q'[
            --/WITH STATEMENT/--
        ]'
    );

    l_export := APEX_DATA_EXPORT.EXPORT(
        p_context => l_ctx,
        p_format  => APEX_DATA_EXPORT.c_format_xlsx
    );

    APEX_EXEC.CLOSE(l_ctx);

    APEX_DATA_EXPORT.DOWNLOAD(p_export => l_export);

    APEX_APPLICATION.STOP_APEX_ENGINE;
END;

The XLSX file is successfully generated and downloaded, but the problem I'm facing is that the file name is “export” and there's no way to change the file name dynamically (at least from what I've read online). Is there another way of generating and downloading an XLSX file as seen above, but so that I can also dynamically change the file name. I know there's a parameter p_file_name, but from version 22.1 onwards and I am on version 21.2.

Thanks for any help!

This post has been answered by Scott Wesley on Jul 7 2025
Jump to Answer
Comments
Post Details
Added on Jul 7 2025
2 comments
126 views