---
title: "Identify the Excel for Confluence app usage using SQL Queries"
canonical: "https://support.appfire.com/space/SUPPORT/2499903665/Identify%20the%20Excel%20for%20Confluence%20app%20usage%20using%20SQL%20Queries"
format: markdown
---
This article explains how to use SQL queries to detect the usage of the Excel for Confluence app macros and determine if particular file encoding settings are applied.

## Instructions

> 📝 The following SQL queries are compatible with the PostgreSQL database. If you are using a different database, modify the SQL syntax according to the database.

### How to identify the pages and spaces using the Excel macro?

To retrieve a list of spaces and pages where the Excel macro is being used, execute the following SQL query:

```
SELECT 
  CONTENT.Title,
  CONTENT.SpaceID,
  SPACES.SPACEKEY
FROM CONTENT
JOIN BODYCONTENT ON CONTENT.CONTENTID = BODYCONTENT.CONTENTID
JOIN SPACES ON CONTENT.SPACEID = SPACES.SPACEID
WHERE CONTENT.PREVVER IS NULL
  AND (CONTENT.CONTENTTYPE = 'PAGE' OR CONTENT.CONTENTTYPE = 'BLOGPOST')
  AND BODYCONTENT.BODY LIKE '%ac:name="excel"%';
```

**Output**

![image](media://2e79f940-b6bc-4699-8554-52bde8a2f1d0)

### **How to identify whether the file encoding is used within the Excel macros?**

To identify if file encoding is applied, execute the following SQL query:

```
SELECT CONTENT.Title, CONTENT.SpaceID
FROM CONTENT, BODYCONTENT
WHERE PREVVER IS NULL
  AND (CONTENT.CONTENTTYPE = 'PAGE' OR CONTENT.CONTENTTYPE = 'BLOGPOST')
  AND CONTENT.CONTENTID = BODYCONTENT.CONTENTID
  AND BODYCONTENT.BODY LIKE '%ac:name="excel"%'
  AND BODYCONTENT.BODY LIKE '%ac:parameter ac:name="encoding"%';
```

**Output**

![image](media://e2a23392-2c92-414e-a1f0-bffcb496e372)

The query will return the pages where the macro is used with the file encoding parameter. If the above query returns no results, it means that no specific file encoding is being used.

Open the page identified by the query > **Edit** the page > **Edit** Excel Macro > Check the **File encoding** parameter applied.

![image](media://3c4446c7-1e26-4140-8a7d-f47ff28831ce)