📋 One-Click Copy: Export Interactive Report Rows as CSV in Oracle APEX

🚩Introduction 

  • In modern Oracle APEX applications, improving user convenience and data accessibility is essential. A handy feature is allowing users to copy row-level data from an Interactive Report as comma-separated values (CSV) directly to the clipboard.

  • By clicking a copy icon on a specific row, users can instantly capture all column values in a structured format, making it easy to reuse the data in tools like Excel, emails, or documents. This approach enhances productivity while keeping the interface simple, efficient, and user-friendly.

📑 Why This Approach Is Needed

In Oracle APEX applications, users often need to extract and reuse report data quickly in external tools like Excel, emails, or documents. Manually selecting and formatting row data can be time-consuming, error-prone, and inefficient.

Allowing row-level data to be copied as comma-separated values (CSV) becomes important when:

  • Users want to quickly capture a row's data with a single click
  • Column values need to remain structured and accurate

  • Data should be ready to paste directly into external tools without extra formatting

  • Applications aim to improve productivity by reducing repetitive manual tasks

  • A seamless, user-friendly interface is required 

This approach ensures faster workflows, fewer errors, and a smoother user experience while keeping the implementation simple and fully integrated within Oracle APEX.

👉 Use Case: Copying Interactive Report Row Data as CSV in Oracle APEX

In Oracle APEX, users often need to quickly extract specific row data from an Interactive Report for using in the external tools like Excel, emails, or documents. By providing a copy icon for each row, the application allows users to instantly copy the row's data as comma-separated values (CSV) to the clipboard.

In this blog, we will see how to implement this functionality in Oracle APEX using JavaScript, enabling users to efficiently capture and reuse report data with a single click, improving productivity and streamlining workflows.

Step 1: 

In the page designer, create a region and change the type to Interactive Report and set the source type as SQL query and copy the SQL Query below.


SELECT EMPNO,
       ENAME,
       JOB,
       MGR,
       HIREDATE,
       SAL,
       COMM,
       DEPTNO,
       '' -- icon placeholder
  FROM EMP;

 Step 2: 

Click on the icon column in the Interactive Report and navigate to the HTML Expression in the properties section and copy the below HTML Code. On clicking this icon, we will call the javascript function copyRecord() to copy the contents to the clipboard.

<!-- Copy Icon for Each Row in the HTML Expression -->

<span
class="fa fa-copy copy-icon" title="copy record" onclick="copyRecord(this)"></span>

Step 3: 

Now Click on the page and go to the Function and Global Variable Declaration section and copy the below javascript function to copy the contents to the clipboard. 

function copyRecord(el) {
  var row = $(el).closest('tr');
  var values = [];

//Get the row values excluding the copy icon column   row.children('td').each(function () {     if ($(this).find('.copy-icon').length === 0) {       values.push(this.innerText.trim());     }   });

// Copy the contents to the clipboard   var record = values.join(",");   if(record != ""){     navigator.clipboard.writeText(record);     apex.message.showPageSuccess("Copied");   } }

Step 4: 

Now save and run the page, you will see the report rendered in the page, clicking on the copy icon in each row, the respective row data will be copied to the clipboard as comma seperated value.





🔥 Conclusion

Thus, in Oracle APEX, we can efficiently enable users to copy Interactive Report row data as comma-separated values (CSV) by adding a row-level copy icon and using dynamic actions with JavaScript. This approach allows users to quickly extract and reuse data in external tools like Excel, emails, or documents, minimizing manual effort and errors. It delivers a smooth, user-friendly experience while keeping the implementation simple, maintainable, and fully integrated within the Oracle APEX platform.

Comments

Popular posts from this blog

🔍 Extending Smart Search Filter for Multiple Regions

💡 Designing Dynamic QuickPicks in Oracle APEX

📌Track Active Tab switch in Region Display Selector without any plugins