AI is an excellent tool with so many applications. It enables us to do things faster, whether it’s with data processing or idea generation. I knew AI could help with coding, but I thought it was for simple one-off functions or samples. However, I was recently astonished by Aaron Patton’s Metadata macro, which he created using ChatGPT. Also, my brilliant interns (Lila Zelnick & Aubrey Cadogan) explained to me this year that with the right AI prompting, you can create VBA code to handle dozens of functions within a macro. So, I wanted to join the bandwagon and give it a try because I’m “With It”… I’m Hip.
When you work in eDiscovery, there are many small software tools you wish you had but don’t because it’s hard to find something you can buy for our niche industry. For example, when I prepare for a trial and need to create trial binders, I would like to obtain a page count for each exhibit. I need this to gauge the time and resources for the print job. Additionally, I appreciate selecting the voluminous exhibits and discussing with the attorney the possibility of excluding or providing an alternative solution for them. You can do this manually by merging the PDFs, or you can use a data processing tool for an extreme approach. But I want something simple, quick, and specific.
Can GenAI assist me in creating a complex macro in Excel? Initially, I just wanted something that would output the file name and page count, but you’ll see I went down quite a productive rabbit hole. Not only did I get what I wanted, but I was being offered great suggestions of what to add.
Below, I’ll share the prompt chat and code, but this is the ChatGPT prompt I started with:
“Create an Excel module that will count the pages of all the files in a folder and subfolder.”
Bam, I got the VBA code for the module and directions on how to insert it; talk about full service!

Next, ChatGPT suggested additional functions to include. One suggestion was to exclude files.
So next, I asked: “Exclude Excel spreadsheets. Also, at the bottom, there should be a tally of the total number of files and pages.”
In the style of Emeril Lagasse, the code got kicked up a notch. So, I continued to add more requests to the output. I asked it to add columns for file type and the file path as clickable links. ChatGPT also started providing me with examples of the output.


I decided to elaborate and asked it to do this:
“If the page count is greater than 500 but less than 1000, highlight the cell with the color orange. If the page count is greater than 1000, highlight the cell with the color red.”
I wanted this so I could quickly spot the large files without sorting them. I kept adding tweaks till I had a finished product that suited my needs. ChatGPT gave me precisely what I wanted.
Lastly, I wanted to get really fancy and add a progress bar listing which file it is processing so I would know how long it would take to process a folder. Also, it would signal if the macro was stuck.
All I asked was to:
“Add a progress bar”
Bam! It did it and gave me instructions on how to incorporate it.


Here is the progress bar in Action.

This exercise showed me that if I’m patient with AI and provide clear, piecemeal prompts, I can achieve what I want. For example, I tried collecting all my prompt and merged it into one giant prompt to see if I would get the same results, and I did not. I got code that didn’t work. I recommend starting simple and building upon it either with your prompts or the suggested ones. However, overall, I felt like I was having a conversation with a developer, which made the experience pleasant.
Here is my ChatGPT chat, which follows everything I did in detail.
https://chatgpt.com/share/6841f922-ccec-8004-b9b2-33f1c149e666
If you want the macro as an XLSM (Macro-Enabled Spreadsheet), you can connect with me and send me a DM on LinkedIn: https://www.linkedin.com/in/deanathanasopoulos/
This journey into using GenAI for eDiscovery tool development has been eye-opening and empowering. What started as a simple request to automate page counts evolved into a robust Excel macro that not only streamlines trial preparation but also identifies key logistical challenges. This macro now plays a vital role in helping me prepare trial binders more efficiently, saving time, resources, and unnecessary manual effort. With each iterative prompt, I uncovered how AI can serve as both a coding partner and idea generator—bridging gaps between needs and solutions in our unique legal tech environment. If you’re in legal operations or litigation support and haven’t yet explored the power of GenAI, now is the perfect time to jump in. You might just build the tool you’ve been wishing someone else would.
Image created using GPT-4o’s Image Creator Powered by DALL-E, using the term “robot lawyer using ChatGPT on a computer”.
Disclaimer: The views represented herein are exclusively the views of the authors and speakers themselves, and do not necessarily represent the views held by my employer, my partners or my clients. eDiscovery Today is made available solely for educational purposes to provide general information about general eDiscovery principles and not to provide specific legal advice applicable to any particular circumstance. eDiscovery Today should not be used as a substitute for competent legal advice from a lawyer you have retained and who has agreed to represent you.
Discover more from eDiscovery Today by Doug Austin
Subscribe to get the latest posts sent to your email.



