A web application for column-wise comparison of two Excel files. Upload source, target, and config files — the tool highlights every cell mismatch in a downloadable text result.
- Column-based comparison using a
.propertiesconfig file - Supports
.xlsxand.xlsformats - Handles STRING, NUMERIC, and BOOLEAN cell types
- Float comparison with epsilon tolerance (
1e-10) - Skips sheets without header rows
- Docker Compose for one-command full-stack deployment
- 23 automated tests (JUnit 5 + Mockito)
- Backend: Java 17, Jakarta Servlets 4.0, Apache POI 5.3, Log4j 2
- Frontend: Vanilla JavaScript, Vite 6
- Infrastructure: Docker Compose, Tomcat 9, nginx:alpine
- Testing: JUnit 5, Mockito 5.12
Browser ──▶ nginx (:80) ── proxy ──▶ Tomcat (:8080)
│ │
├── static assets ├── POST /Compare
│ (dist/) ├── GET /health
│ └── Apache POI
└── /templates/
See docs/architecture.md for the full system diagram and component breakdown.
- Docker & Docker Compose (recommended — no manual setup)
- Alternative: JDK 17+, Maven 3.9+, Node.js 18+
# Build and start everything
docker compose -f docker/docker-compose.yml up --build
# Backend health: http://localhost:8080/health → OK
# Frontend UI: http://localhostThe frontend includes sample files in frontend/public/samples/ for quick testing.
Backend (requires JDK 17+, Maven 3.9+, Tomcat 9):
cd backend
mvn clean packageDeploy target/CompareUI.war to Tomcat's webapps/ROOT.war (delete the existing ROOT directory first). Start Tomcat — the API will be available at http://localhost:8080.
Frontend (requires Node.js 18+):
cd frontend
npm install
npm run devOpens at http://localhost:5173 with hot-reload. API requests to /Compare and /health are proxied to the Tomcat backend at http://localhost:8080.
- Open
http://localhostin a browser - Upload Source File (
.xlsx/.xls), Target File (.xlsx/.xls), and Property File (.properties) - Click COMPARE FILES
- A
result_file.txtis downloaded with every mismatch
sourceColumns=Name,Address,Age
targetColumns=Name,Address,AgeColumn names must match the header row in each file exactly (case-sensitive).
Pre-built samples are at frontend/public/samples/:
ExcelSourceFile.xlsx— source workbookExcelTargetFile.xlsx— target workbook (4 intentional mismatches)Excel.properties— config mappingName,Address,Age,CreditLimit
| Endpoint | Method | Description |
|---|---|---|
/Compare |
POST | Upload 3 files (multipart), returns text result |
/health |
GET | Returns OK (used by Docker healthcheck) |
cd backend
mvn test23 tests across 4 test classes:
CompareTest(7) — servlet requests: missing parts, success, errorsComparisonConfigTest(5) — property file parsingComparisonServiceTest(6) — comparison logic, edge casesWorkbookUtilsTest(5) — cell value extraction
- Modular architecture — Separated into
Comparerinterface,ComparisonService, andComparisonOrchestratorfor clean dependency injection and testability - Robust error handling — Sanitized HTTP responses with no stack trace leakage; comprehensive Log4j2 logging
- Precision comparison — Epsilon-based float comparison (
Math.abs(a - b) < 1e-10) handles floating-point drift; supports STRING, NUMERIC, and BOOLEAN cell types - File lifecycle management — Workbooks are opened, read, and closed in a controlled
finallyblock to prevent resource leaks - Test coverage — 23 automated tests across servlets, config parsing, comparison logic, and utility functions
excel-compare/
├── backend/
│ ├── src/main/java/compare/
│ │ ├── Compare.java # Servlet — HTTP entry point
│ │ ├── HealthServlet.java # GET /health
│ │ ├── Comparer.java # Interface for testability
│ │ ├── ComparisonService.java # Core comparison logic
│ │ ├── ComparisonOrchestrator.java # Workflow + lifecycle
│ │ └── WorkbookUtils.java # Cell value helpers
│ └── src/test/java/compare/
│ ├── CompareTest.java
│ ├── ComparisonConfigTest.java
│ ├── ComparisonServiceTest.java
│ └── WorkbookUtilsTest.java
├── frontend/
│ ├── src/ # Vite source
│ │ ├── index.html
│ │ ├── script.js
│ │ └── style.css
│ ├── public/ # Copied as-is to dist
│ │ ├── samples/
│ │ ├── templates/ # Instructions + demo page
│ │ ├── images/
│ │ └── style.css
│ └── vite.config.js
├── docker/
│ ├── docker-compose.yml
│ ├── Dockerfile.backend
│ └── nginx.conf
└── docs/
├── architecture.md
├── workflow.md
└── images/
└── ui-screenshot.png
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-change) - Make changes and run tests:
cd backend && mvn test - If changing the frontend:
cd frontend && npm run build - Commit and open a Pull Request
Copyright © 2024 Akshay Tadakod. All Rights Reserved.
