https://github.com/quangxuan98765/excel-data-processing-api
Professional ASP.NET Core Web API for Excel Data Processing & Bulk Database Operations - Portfolio Project
https://github.com/quangxuan98765/excel-data-processing-api
aspnet-core bulk-insert demo-project dotnet-core excel-processing power-automate sql-server web-api
Last synced: 5 months ago
JSON representation
Professional ASP.NET Core Web API for Excel Data Processing & Bulk Database Operations - Portfolio Project
- Host: GitHub
- URL: https://github.com/quangxuan98765/excel-data-processing-api
- Owner: quangxuan98765
- License: mit
- Created: 2025-07-26T09:58:32.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-07-26T14:18:42.000Z (5 months ago)
- Last Synced: 2025-07-26T16:29:53.322Z (5 months ago)
- Topics: aspnet-core, bulk-insert, demo-project, dotnet-core, excel-processing, power-automate, sql-server, web-api
- Language: C#
- Homepage:
- Size: 41 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# π Excel Data API
> **ASP.NET Core Web API for Excel Data Processing & Bulk Database Operations**
## π Overview
Excel Data API is a robust .NET 8 Web API designed to handle bulk data import from Excel files through Power Automate integration. The API provides comprehensive data validation, error handling, and efficient database operations.
### β¨ Key Features
- π **Bulk Data Insert**: Efficiently process and insert large datasets from Excel files
- β
**Data Validation**: Comprehensive validation with detailed error reporting
- π **Power Automate Integration**: Seamless integration with Microsoft Power Automate flows
- π **Detailed Logging**: Complete audit trail with user tracking
- π‘οΈ **Error Handling**: Robust error handling with user-friendly responses
- π **SQL Server Integration**: Optimized database operations with connection pooling
## ποΈ Architecture
```
ExcelDataAPI/
βββ Controllers/ # API Controllers
β βββ BulkInsertController.cs
βββ Models/ # Data Models & DTOs
β βββ BulkInsertRequest.cs
β βββ BulkInsertResponse.cs
β βββ ExcelInputRow.cs
β βββ ExcelOutputRow.cs
β βββ FinancialDataRow.cs
β βββ ValidationResult.cs
βββ Services/ # Business Logic
β βββ DataService.cs
β βββ ValidationService.cs
βββ Program.cs # Application Entry Point
```
## π οΈ Technology Stack
- **Framework**: .NET 8.0
- **Web Framework**: ASP.NET Core
- **Database**: SQL Server
- **Data Access**: Microsoft.Data.SqlClient
- **API Documentation**: Swagger/OpenAPI
- **Architecture**: Clean Architecture with Service Layer
## π Prerequisites
- .NET 8.0 SDK
- SQL Server (LocalDB, Express, or Full)
- Visual Studio 2022 / VS Code (optional)
- Power Automate (for integration)
## π Getting Started
### 1. Clone the Repository
```bash
git clone https://github.com/quangxuan98765/excel-data-processing-api
cd ExcelDataAPI-Project
```
### 2. Configure Database Connection
Update connection string in `appsettings.json`:
```json
{
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=YourDatabase;Trusted_Connection=true;"
}
}
```
### 3. Build and Run
```bash
cd ExcelDataAPI
dotnet restore
dotnet build
dotnet run
```
### 4. Access API Documentation
- **Swagger UI**: `https://localhost:7xxx/swagger`
- **API Base URL**: `https://localhost:7xxx/api`
## π API Endpoints
### POST `/api/BulkInsert/financial-data`
Bulk insert financial data with validation.
**Request Body:**
```json
{
"data": [
{
"soTaiKhoan": "1234567890",
"tenTaiKhoan": "Nguyen Van A",
"soTien": 1000000,
"ngayGiaoDich": "2024-01-15",
"moTa": "Thu nhαΊp thΓ‘ng 1"
}
],
"idNguoiDung": "USER001",
"nguoiNhap": "Admin User"
}
```
**Response:**
```json
{
"success": true,
"message": "Xα» lΓ½ thΓ nh cΓ΄ng 1/1 bαΊ£n ghi",
"totalRows": 1,
"successRows": 1,
"errorRows": 0,
"errors": [],
"processedData": [...]
}
```
## π§ Power Automate Integration
The API is designed to work seamlessly with Power Automate flows:
1. **Excel Online Connector**: Read data from Excel files
2. **HTTP Connector**: Send data to API endpoint
3. **Data Transformation**: Format data according to API schema
4. **Error Handling**: Process API responses and handle errors
## π§ͺ Testing
### Using Swagger UI
1. Navigate to `/swagger`
2. Expand the `POST /api/BulkInsert/financial-data` endpoint
3. Click "Try it out"
4. Enter sample data and execute
### Using PowerShell (Example)
```powershell
$body = @{
data = @(
@{
soTaiKhoan = "1234567890"
tenTaiKhoan = "Test Account"
soTien = 1000000
ngayGiaoDich = "2024-01-15"
moTa = "Test transaction"
}
)
idNguoiDung = "TEST_USER"
nguoiNhap = "Test Admin"
} | ConvertTo-Json -Depth 3
Invoke-RestMethod -Uri "https://localhost:7xxx/api/BulkInsert/financial-data" -Method POST -Body $body -ContentType "application/json"
```
## π Database Schema
### FinancialData Table
```sql
CREATE TABLE FinancialData (
Id BIGINT IDENTITY(1,1) PRIMARY KEY,
SoTaiKhoan NVARCHAR(50) NOT NULL,
TenTaiKhoan NVARCHAR(255) NOT NULL,
SoTien DECIMAL(18,2) NOT NULL,
NgayGiaoDich DATE NOT NULL,
MoTa NVARCHAR(500),
IDNguoiDung NVARCHAR(100) NOT NULL,
NguoiNhap NVARCHAR(255) NOT NULL,
NgayTao DATETIME2 DEFAULT GETDATE(),
NgayCapNhat DATETIME2 DEFAULT GETDATE()
);
```
## π‘οΈ Security Features
- Input validation and sanitization
- SQL injection prevention
- Data type validation
- Business rule validation
- Comprehensive error logging
## π Future Enhancements
- [ ] Authentication & Authorization (JWT)
- [ ] File upload endpoint for direct Excel processing
- [ ] Data export functionality
- [ ] Real-time processing status
- [ ] Batch processing queues
- [ ] Advanced reporting features
## π Contributing
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## π License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## π Contact
**Developer**: [Quang](#)
**Email**: [acongchuongheo@gmail.com](mailto:acongchuongheo@gmail.com)
**LinkedIn**: [Quang XuΓ’n](https://www.linkedin.com/in/quang-xuan-669491349/)
**GitHub**: [@quangxuan98765](https://github.com/quangxuan98765)
---
β **Star this repository if you find it helpful!**
> This project demonstrates professional .NET development practices, clean architecture, and real-world API design patterns. Perfect for learning, portfolio showcasing, and practical business applications.