Add Excel-like filters to table in Confluence
Asked by Sam:

How would I create filters on a Confluence table that act like filters in Excel do? For instance, I would like to make small buttons appear on the topmost cells of each column that, when clicked on, would show a text box. For example, if someone typed "asdf" in that text box, the table would then hide rows that don't have that text in that column.

CustomerSystemEnvironment

|---------|----------|------|
| Ai      | Delivery | Prod |
| Ai      | Mirth    | Dev  |
| Dresner | Delivery | Dev  |


Answers:
author: A C
body: Hi, I need a macro that filters not all columns, but one column.  
Will you help in this matter?


author: Rahul Savaikar
body: Hello [@Sam](/t5/user/viewprofilepage/user-id/3690189) ,

Please try this method of creating a user macro.

<https://community.atlassian.com/t5/Confluence-articles/The-Admin-s-tale-User-Macro-filtering-a-Confluence-table/ba-p/459369>

It has worked for me for quite some time.

Procedure:  
1. Go to http://host:port/admin/usermacros.action  
2. Click on "*Create a User Macro* "  
3. Macro Name: filter-all-tables  
4. Visibility: Visible to all users in the Macro Browser  
5. Macro Title: Filter all tables (This text will help you search the macro)  
6. Categories: Confluence content  
7. Macro content

```

## Macro Name: filter-all-tables
## Macro Title: Filter all tables
## Category: Confluence Content
## Macro has a body: N
## Body processing: None
##
## Source: https://community.atlassian.com/t5/Confluence-articles/The-Admin-s-tale-User-Macro-filtering-a-Confluence-table/ba-p/459369
## Date created: 2018-02-26

## @param FilterID:title=FilterID|type=string|required=true|desc=ID [a-z,A-Z,0-9]
## @param Label:title=Label|type=string|required=true|desc=Label
## @param Class:title=Length of the input field|type=enum|enumValues=short-field,medium-field,medium-long-field,long-field,full-width-field|default=long-field
## @param ColumnNumber:title=Column Number|type=string|required=true|default=-1|desc=Specify the column number or "-1" for the entire row

<form class="aui">
<input class="text $param0" type="text" id="searchInput" placeholder="Filter all tables (case insensitive)">
</form>

<script type="text/javascript">
AJS.$("#searchInput").keyup(function () {
var jqry = AJS.$
var rows = jqry("tr").hide();
var searchData = this.value;
if (searchData.length) {
## This change will allow single word search only
var data = searchData.toLowerCase().split(" ");
## This change will allow multi word search
## var data = searchData.toLowerCase();
jqry.each(data, function (search_idx, str) {
rows.filter(function(row) {
return $(this).text().toLowerCase().indexOf(data) >= 0;
}).show();
});
} else rows.show();
AJS.$('thead tr').show();
});
</script>
```


author: Jaclyn Mazzarella
body: Hello, I know that standard Confluence tables do not allow for filtering of that kind. To perform the level of filtering you want, you will have to download an app/macro.

By downloading an app called [Excellentable](https://marketplace.atlassian.com/apps/1211672/excellentable-spreadsheet-for-confluence?hosting=server&tab=overview), you are able to perform Excel-like functions without leaving Confluence and ridding the need to use standard tables. Specifically, the feature in Excellentable that can solve your issues above is [view \& edit mode filters](https://www.addteq.com/exc/user-guide/faqs-how-to-use-excellentable/how-to-create-a-filter). Hope this helps!

comments: author: Jaclyn Mazzarella
body: I also see another app here: [https://marketplace.atlassian.com/apps/27447/table-filter-and-charts-for-confluence?hosting=cloud\&tab=overview](https://marketplace.atlassian.com/apps/27447/table-filter-and-charts-for-confluence?hosting=cloud&tab=overview)

You can see a "demo" of it here:

<https://demo.stiltsoft.com/display/tblfilter/Filtering+Text+Table+Data>


author: Sam
body: Hi Jaclyn, thank you for responding so quickly! I'm looking for a way to do this with a macro and no apps. Could you help me find a solution without apps?


author: Jaclyn Mazzarella
body: Hello, no problem! Unfortunately, there is no way, that I am aware of, to filter out-of-the-box Confluence tables without an app installed on your Confluence instance.


author: Sam
body: Do you think you could escalate this ticket to someone who might know a way to do that?


author: Rahul Savaikar
body: posted as answer


Tags: confluence-server

server