Skip to content
한국어

Automate Repetitive File Work Without Coding: Merge Excel Files and Tidy File Names with Claude Code

In short
  • This is an exercise in handing monthly chores like “merge twelve Excel files” and “fix file names one by one” to Claude Code in plain words. You don’t need to write or read code.
  • The very first thing to do is back up by copying the folder. File renames and deletions may not come back with /rewind (the reason is explained below).
  • The order is check the plan in plan mode → test with 3 files → read the approval screen → open the result yourself → run on everything.
  • Installation and login are in C12, the first-exercise flow is in Tutorial 6, and general safety habits are in Tutorial 27. This tutorial doesn’t repeat them.
  • Claude Code is available on paid plans (Pro or higher) (C2, as of 2026-11-02).

What you’ll be able to do after this tutorial

Section titled “What you’ll be able to do after this tutorial”
  • Hand off the job of merging many Excel (or CSV) files in a folder into one table in plain words.
  • Rename files in bulk with a rule like “date_client_type”, and learn how to get a preview before the change is made.
  • Clean up blank lines, duplicates, and messy formatting in a CSV, getting the result as a new file while the original stays untouched.
  • Understand the difference between backups, the approval screen, and the role and limits of /rewind for getting back when something goes wrong.
Term What it means in this exercise
Working folder The area Claude Code can read and write. You start in just one practice copy of a folder.
Backup A copy of the whole folder made before you start working. It’s the most important safeguard in this tutorial.
Approval screen The screen where Claude asks “Is it OK to do this?” before changing files or running a command.
Plan mode A mode that only proposes a plan without changing files. Switch with Shift+Tab.
Checkpoints and /rewind A feature where Claude records the state before changing files, and /rewind returns to that point.

Claude Code is a coding tool by name, but it can read and write files in a folder and run commands, so it can also be used for repetitive file work. The examples and prompts in this tutorial are practice tasks made by this site, not examples from the official docs. Work like the following, with clear rules and results you can check with your own eyes, is a good fit.

Good fit Be careful with
Merging several Excel or CSV files of the same format into one Work that must preserve documents with lots of formatting, formulas, or charts exactly
Adding dates, numbers, or client names to file names by a rule Important files with only one original and no copy
Removing blank lines from a CSV, checking duplicates, standardizing column names Material like personal information or payroll that must not go outside (see Using it safely below)

Tutorial 27 introduced /rewind, but for file-organizing work you need to know its limits. According to the official checkpointing docs (checked 2026-11-02):

  • Things changed by Claude’s file-editing tools are tracked and can be undone.
  • However, files changed only by commands like rm (delete), mv (move or rename), and cp (copy) aren’t tracked and can’t be undone with /rewind. (If a file was already edited by Claude’s editing tools, changes made by commands afterward are said to be undone along with it.) Bulk file renaming is usually done only by commands, so it isn’t covered by undo.
  • Checkpoints keep file snapshots for up to the most recent 100 per session, and under default settings the snapshots are deleted about 30 days after the session was last saved.
  • Files you change yourself outside Claude Code usually aren’t recorded.
  • The docs also say checkpoints don’t replace version control like Git.

So for file work, copying the folder before you start is a more reliable safeguard than /rewind.

0/8 done
  1. Make a backup and prepare a practice folder

    In File Explorer (Windows) or Finder (Mac), copy the whole folder you’ll work on and paste it in a different location. Adding _backup to the end of the name keeps you from getting confused. Next, create a new folder called practice, and copy 3 to 5 Excel files of the same format into it. Don’t use sensitive material like real payroll or customer contact details; start with practice sample data.

    If the folder is managed with Git, Git is also a good safeguard, but if you’re a beginner, copying the folder is easiest. Git is covered in Tutorial 8.

  2. Start Claude Code in the practice folder and switch to plan mode

    Open a terminal in the practice folder and run claude. If the terminal is new to you, read Tutorial 6 first. Start in the default mode that asks for confirmation on every change, then press Shift+Tab to switch to plan mode. According to the official permission modes docs (checked 2026-11-02), the default (Manual) mode runs reads without asking, and plan mode investigates files and proposes a plan but doesn’t edit source until you approve.

    Terminal window
    cd ~/Desktop/practice
    claude
  3. Merging Excel files: have it read first

    Don’t have it merge right away; have it read and report what’s in the folder. If column names differ from file to file or there’s a title row at the top, merging easily goes wrong, so it’s good to check first.

    Copy and paste this prompt

    Read the Excel files in this folder and tell me: (1) the file names and the sheet names in each file (2) whether the column names in each sheet are the same or different across files (3) how many data rows there are. Don’t change or create anything yet, just report. If you need to install a program to read them, tell me first which one you’d install.

    If it asks for approval to install a program or run a command, read the command on screen, and if you don’t understand it, first ask, “Explain what this command does.” Installation commands like pip or npm may come up here; since they add programs to your computer, check the name of what’s being installed before allowing it.

  4. Ask for the merge: new file, original untouched

    If the report is right, ask for the merge. The key is to have it save to a new file without touching the originals, and to get numbers you can check.

    Copy and paste this prompt

    Merge the Excel files in this folder into one table and save it as a new file called “merged-result.xlsx”. Never modify or delete the original files. In the merged table, add “source file name” as the first column. When you’re done, tell me (1) the row count of each file before merging (2) the total row count after merging (3) the total of the amount column. If there are any files or columns that weren’t merged, don’t hide them; tell me.

    Screen guide: The screen where Claude Code asks for approval to create a new fileSee this screen in the official help ↗

    On the approval screen, look at just three things: (1) is the name of the file being created merged-result.xlsx, (2) is it inside the working folder, and (3) are there no delete (rm) or rename (mv) commands mixed in. If you see a deletion you didn’t ask for, don’t allow it and ask why.

  5. Open the result yourself and double-check

    Don’t just trust Claude saying “done”; open merged-result.xlsx yourself in Excel. The official best practices also recommend giving Claude a way to check its own work and asking for evidence instead of claims of success (checked 2026-11-02). Check the following four things.

    • Does the total row count match the number Claude reported? (Add up the per-file row counts yourself.)
    • Is the amount total right? In Excel, if you select the column, the total appears at the bottom of the screen.
    • Is an entire file missing?
    • Have dates or numbers turned into text?

    If there’s a problem, say what you saw. For example:

    Copy and paste this prompt

    I opened merged-result.xlsx and there are 118 rows total, but the per-file row counts add up to 124. Find which file lost 6 rows and tell me. Explain the cause first, then fix it.

  6. Renaming files in bulk: preview first

    Renaming files is a classic task that’s hard to get back from once run. So get only the “current name → new name” list before changing anything.

    Copy and paste this prompt

    I want to rename the Excel files in this folder using the rule “YYYY-MM-DD_client_type.xlsx”. Find the date and client from the current file names or the contents of each file. Don’t rename anything yet; first show me “current name → new name” in a table. Flag separately any files where names would collide or where you couldn’t find the information the rule needs.

    Read the table and fix wrong lines in words. If everything’s right, run it with the flow below.

    The order for renaming files safely
    1. File Explorer / FinderCopy the whole folder to make a backup→ You have an original to return to even if the renaming goes wrong
    2. Claude CodeGet the "current name → new name" table, read it, and fix it→ You check the result with your own eyes before running
    3. Claude CodeAsk, "Rename the files according to this table. Don't delete anything."→ The approval screen appears
    4. Approval screenRead whether the mv (rename) commands match the table, then allow→ The file names change
    5. File Explorer / FinderCompare the file count and names against the backup folder→ Confirm that no files are missing

    This is a simplified flow. See the official help page for the actual screens.

  7. Cleaning up a CSV: get it as a new file

    A CSV is a simple table file separated by commas, so cleanup requests are relatively simple. Likewise, leave the original and get the cleaned version as a new file.

    Copy and paste this prompt

    Clean up “transactions.csv” and save it as “transactions_cleaned.csv”. Don’t modify the original. The cleanup is: (1) remove completely blank lines (2) trim leading and trailing spaces from every column (3) standardize dates to YYYY-MM-DD format (4) if there are completely identical lines, don’t delete them, just tell me how many there are. When you’re done, summarize the row counts before and after and what you changed.

    If text is garbled when you open the cleaned file in Excel (for example, Korean characters), it may be a file saving method (encoding) issue. We couldn’t confirm the cause for this in the official docs. Describe exactly how it looks broken and ask, “Save it so the text isn’t garbled in Excel.”

  8. Apply to the whole folder and wrap up

    Once you’ve confirmed in the practice folder that the results are right, make the same request in a copy of the real data folder. You still don’t write directly to the originals. When it’s done, check like this.

    Copy and paste this prompt

    List every file you just created, changed, or deleted in this folder. Also tell me whether any of the files that count as originals were modified. Don’t change anything yet.

    If you’ll do the same job next month, write down the request sentences you used, or put “Don’t modify the originals; save to a new file” in a guide note (CLAUDE.md). CLAUDE.md is covered in step 7 of Tutorial 6 and in C14.

Habit Why and how
Copy the folder before working Files changed by commands don’t come back with /rewind. A copy is the surest.
Originals are read-only, results go to a new file Be sure to include “Don’t modify or delete the originals” in the prompt.
Test on a small number, then scale up Check the rules on 3 to 5 files, then apply to everything.
Look for rm on the approval screen If a delete command shows up that you never asked for, don’t allow it; ask why.
Double-check results with your own eyes Match the row counts and totals yourself.
Be careful with sensitive material By default, don’t keep payroll, national ID numbers, or customer contact details in the conversation or the folder. Whether you may use internal material with an outside service is a company policy question first. For the basic principles, see Privacy and safety.

The many approval questions can be frustrating. According to the official permission modes docs (checked 2026-11-16), acceptEdits mode runs file edits and common file commands (mkdir, touch, rm, rmdir, mv, cp, and sed) inside the working folder without asking. That’s convenient, but it also means a rename or a delete runs immediately without asking. The same doc says auto mode doesn’t guarantee safety either and advises using it for tasks whose direction you trust. Use it only after you’ve made a backup and confirmed in the practice folder that the rules are right. The kinds of modes are summarized in C14.

Situation Try saying this
Understand first “Read the files in this folder and tell me [what]. Don’t change anything yet.”
Merging “Merge [the files] and save as [new file name]. Don’t modify or delete the originals. Tell me the row counts before and after and the total.”
Renaming “I want to rename them by [rule]. Don’t rename; first show me a ‘current name → new name’ table.”
CSV cleanup “Save a cleaned version with [the cleanup] applied as a new file. Leave the original as is.”
Double-checking “Compare the row count and total of the file you just made against the originals and tell me.”
Auditing “List the files you created, changed, or deleted in this folder.”
Key / command What it does
Shift+Tab Change permission mode (including plan mode)
Esc twice (when the input box is empty), /rewind Restore menu. Choose to restore code, the conversation, or both
/clear Start a new conversation (files stay as they are)
/permissions View and manage permission rules

The row count of the merged result doesn’t match

Section titled “The row count of the merged result doesn’t match”
  • Cause: Some files may have a title row at the top, different column names, or missing sheets.
  • Fix: Go back to the “read and report only” request from step 3 and check the structure of each file. Then ask, “Find the files whose row counts don’t match.” As advised earlier, the habit of matching the numbers yourself is important.
  • Cause: The default mode requires approval for each change.
  • Fix: Reduce the number of files and bundle requests together, or use acceptEdits mode after making a backup. Just read the cautions in Using it safely above first.
  • Cause: It may be a file saving method issue, but we couldn’t confirm it in the official docs.
  • Fix: Describe the symptom and ask it to save again so it isn’t garbled when opened in Excel. Check that the original is still untouched.
  • Cause: Rename commands aren’t covered by /rewind.
  • Fix: Check the original names in the backup folder and ask, “Restore the names based on the backup folder,” or copy them over yourself.
  • Cause: Failed attempts may have piled up in the conversation.
  • Fix: As the official best practices recommend, start fresh with /clear and ask again, describing the current state and the result you want more specifically.
  • Describe rules with numbers and examples. Instead of “neat”, give one example like “in the form 2026-10-01_HanbitTrading_quote.xlsx” and mistakes drop.
  • Ask for one thing at a time. If you ask for merging, renaming, and CSV cleanup all at once, it’s hard to find where it went wrong.
  • Go back to plan mode when it gets complicated. For jobs with lots of files, it’s better to get a plan first.
  • You can also solve it inside Excel. For calculation and analysis inside a file, the AI features built into Excel and Google Sheets, as in Tutorial 23, may be better. This tutorial suits work that “handles multiple files”.
  • If you’re worried about how much you’re using, see the usage guide in C2 first.

Sources

Last verified: Nov 16, 2026

Prices, limits, and menu names change often. Before making an important decision, check the official pages above for the latest details.