How to automate Excel: macros, Python or AI?

4 min readUpdated Skillshop operator and creator of the Maker Evan YouTube channel

Translated from Korean. View original. Some screenshots are available in Korean only.

Excel automation can use macros, scripts such as Python or AI tools. Choose based on whether you repeatedly apply formatting, combine files or organize tables that vary each time. Keep the originals, test on a small file and check row counts and totals.

Browse relevant skills and examples on Skillshop.

View original Korean screenshot
스킬샵의 데이터·엑셀 카테고리 화면. 데이터 정리와 자동화를 다루는 스킬 카드가 놓여 있다.
스킬샵에서 관련 작업의 스킬과 사용 예시를 살펴볼 수 있어요.

When do macros, scripts and AI help?

Macros run repeated Excel actions as code. You can start by recording actions and edit them later. Scripts can process multiple files in batches or retrieve external data.

AI tools let you describe the task in words. You can also ask for a macro or script, validate the code and run the verified code repeatedly.

MethodHow to request or write itCharacteristics
MacroRecord actions or write code.Runs repeated Excel work.
ScriptWrite file processing and calculations as code.Can process multiple files or retrieve external data.
AI agentDescribe the input and desired result.Processes files or helps write macros and scripts.
You can combine these methods by validating AI-written code before repeating it.
MacroInside ExcelRecord repeated actions or write code to run them.
ScriptOutside ExcelCombine files, repeat fixed calculations or retrieve data from another system.
AI agentDescribe in wordsInspect files and make context-dependent decisions.
Macros run repeated Excel work as code.

Consider file format and frequency

For repeated formatting or print settings, consider a macro. For combining or processing many files, a script or data import may also fit.

If column names and sheet structures change, you can ask AI to analyze differences first. Macros can also process several files, so do not choose by count alone; consider the actual task and what you can maintain.

Files always have the same shape
  • The same action on a daily file
  • Formatting, column order and print settings
  • Consider a macro or script
Future input is less predictable
  • Column names change
  • Sheets are added or removed
  • An agent can inspect and assess differences
Consider a macro for repeated formatting or print settings.

Provide inputs and expected outputs for formulas

Along with a request such as “sum values under this condition,” provide input examples, expected results and how blanks should be handled. You can describe the calculation without already knowing a function name.

Include your Excel version and environment; supported functions and formula separators may differ. Apply the formula to a small range and check normal and boundary values before expanding it.

Give examplesShow a few inputs and expected outputs.
Describe the environmentInclude your Excel version and formula separators.
Get a formulaAsk for the output shape shown in your examples.
Test smallCheck a few rows before applying it to the entire column.
Provide input examples, expected results and blank handling.

Normalize formats before combining files

Before combining, check that column names, date formats and currency units match. Define a standard and convert each file before merging so errors can be traced to a source file.

Preserve the originals and include the source filename in the output. If removing duplicates, record the duplicate criteria and number of rows removed.

Keep originals separateWork on copies so you can recover from a mistake.
Normalize formatsAlign column names and date formats first.
Then combineMerge standardized files and retain provenance.
Keep the source columnIdentify which file each row came from.
Check column names, date formats and currency units before merging.

Compare row counts, totals and periods

A file opening successfully does not prove its contents are correct. Compare row counts and key totals before and after merging, and verify the expected date range.

Spot-checking rows helps but does not replace full validation. Check blanks, duplicates and negatives; preserve source formulas and compare current calculated values with the result.

Row countDoes it match before and after merging?
TotalsDo key numeric totals match the sources?
PeriodAre the earliest and latest dates unchanged?
Samples and exceptionsCompare selected rows with their sources.
Opening a file is not proof that its contents are correct.

Save validation steps for repeated work

Record input format, conversion order, save location and validation criteria in a document or skill. If totals do not match, ask it to report the difference rather than finalize the result.

When referring to a public Excel skill, check its scripts and execution environment too. Run it once on example files, then adapt differences to your own rules.

  • xlsx/An Excel skill
  • SKILL.mdWhat to do and in what order
  • scripts/Files to run repeatedly
  • LICENSE.txtTerms for reuse
Record validation criteria with the input, conversion order and save location.

Browse relevant skills, creators and examples on Skillshop.

View original Korean screenshot
스킬샵 데이터·엑셀 카테고리 화면. 데이터 정리와 자동화를 다루는 스킬 카드가 놓여 있다.
관련 스킬과 제작자, 사용 예시를 살펴볼 수 있는 스킬샵 화면이에요.

Frequently asked questions

How do Excel macros differ from scripts?

Macros run repeated Excel actions as code and can be recorded or written directly. Scripts such as Python can batch-process files or retrieve external data. Macros can also handle multiple files, so choose for the task and your maintenance capacity.

Why does an AI-provided formula return an error?

The formula or references may be wrong, or your Excel version and separators may differ. Provide examples, expected results, your environment and the actual error. Check normal and boundary values on a small range before expanding.

What should I do first when combining Excel files?

Preserve the originals and compare column names, date formats and currency units. Standardize before merging and retain source filenames. Then compare row counts, totals and dates, and record duplicate-removal criteria.

Sources