---
title: "DataTables Excel Export &#8211; How to display URLs"
date: 2026-04-23
author: "GravityKit"
link: "https://www.gravitykit.com/docs/gravityview-pro/datatables/datatables-excel-export-how-to-display-urls/"
---

By default, DataTables does not include links on an Excel export. With the help of the code snippet below, you'll be able to display URLs on your Excel export files.

```
document.addEventListener("DOMContentLoaded",function(){wp.hooks.addFilter("gk.datatables.options","dt-custom-code",function(o){return o.buttons=o.buttons.map(t=>("excel"===t.extend&&(t.exportOptions={format:{body:function(t){if(t.indexOf("
```

```
document.addEventListener("DOMContentLoaded",function(){wp.hooks.addFilter("gk.datatables.options","dt-custom-code",function(o){return o.buttons=o.buttons.map(t=>("excel"===t.extend&&(t.exportOptions={format:{body:function(t){if(t.indexOf("
```

This code has been minified to make it easy to be copied. [Here's a link to the full code](https://gist.github.com/rafaehlers/98003df7cff95847da4c9af06ec11d07).

This JavaScript code should be copied and pasted, as it is, on the Custom JavaScript editor that sits inside View Editor > View Settings metabox > Custom Code tab.

![Custom JavaScript added in settings to modify DataTables export, ensuring URLs display in Excel export](https://www.gravitykit.com/wp-content/uploads/2025/10/file-gQgXe30rTp.png)