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

🚩Introduction 

  • In modern Oracle APEX applications, it is important to make data easy to access and use. A useful feature is letting users copy a row of data from an Interactive Report as comma-separated values (CSV) directly to the clipboard.

  • With a simple click on a copy icon in a row, users can quickly copy all the values in that row. They can then easily paste it into Excel, emails, or documents. This makes work faster, improves productivity, and keeps the application simple and easy to use.

📑 Why This Approach Is Needed

In Oracle APEX applications, users often need to quickly copy report data and use it in tools like Excel, emails, or documents. Doing this manually can take time, lead to mistakes, and feel less efficient.

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

  • Users want to copy a full row with a single click
  • Data needs to stay structured and accurate

  • Users should be able to paste it directly into tools like Excel or emails without extra formatting

  • Applications aim to reduce manual work and improve productivity

  • A simple and smooth user experience is important

This approach helps users work faster, reduces errors, and makes the overall experience smoother while keeping everything simple and well integrated in Oracle APEX.

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

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

In this blog, we will see how to implement this feature in Oracle APEX using JavaScript. It helps users copy and reuse report data with a single click, making work faster, improving productivity, and simplifying everyday tasks.

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, adding a copy icon to each Interactive Report row allows users to quickly copy data as CSV using JavaScript. This makes it easy to reuse data in tools like Excel or emails, reduces manual effort and errors, and improves overall usability while keeping the implementation simple.  


Comments

Popular posts from this blog

🔍 Extending Smart Search Filter for Multiple Regions

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

💡 Designing Dynamic QuickPicks in Oracle APEX