š CSV/Excel Data Sanitization Tool
Go-based tool for automated CSV/Excel processing with row filtering and organized output.

⨠Key Features
- Auto Conversion: Transforms Excel files (.xlsx/.xls) to CSV
- Smart Filtering: Removes rows with empty specific columns
- Structured Output: Organizes results in file-specific folders
- Multi-file Support: Processes multiple files via .env config
- Detailed Logging: Tracks all operations with severity levels
ā” Prerequisites
- Go 1.16+
- Excelize v2:
go get github.com/xuri/excelize/v2
š§ Configuration (.env)
# Base directories
DATA_OUTPUT_DIR=data # Processed output folder
DOCS_DIR=docs # Source files folder
# File configuration (default for 3 files)
FILE_1=report1.xlsx
EXCLUDE_ROW_FILE_1=Sale_ID # Column to filter empty rows
FILE_2=customers.csv
EXCLUDE_ROW_FILE_2=SSN
FILE_3=products.xls
EXCLUDE_ROW_FILE_3=Internal_Code
š Basic Usage
- Place files in
docsfolder - Configure .env variables
- Run:
go run main.go
# Expected output:
ā
processed docs/report1.xlsx ā data/report1/sanitized_report1.csv
ā
processed docs/customers.csv ā data/customers/sanitized_customers.csv
āļø skipping products.xls (unsupported extension)
š Output Structure
data/
āāā report1/
ā āāā report1.csv # Converted CSV
ā āāā sanitized_report1.csv # Filtered data
āāā customers/
āāā customers.csv
āāā sanitized_customers.csv
š Processing Flow
š Error Handling
| Common Error | Solution |
|---|---|
DOCS_DIR is not set | Set variable in .env |
Unsupported extension | Use .csv, .xlsx or .xls |
Columns mismatch | Verify file headers |
Permission denied | Adjust folder permissions |
š Customization
1. Add More Files
Edit .env:
FILE_4=new_data.xlsx
EXCLUDE_ROW_FILE_4=Expiry_Date
2. Modify Filter Logic
Adjust filterCSV() for different conditions:
// Example: filter specific values instead of empty
if row[idx] == "DELETE" {
continue
}
3. Add New Formats
Extend processFile() for other types:
case ".ods":
err = convertODSToCSV(inputPath, origPath)
š License
MIT License - See LICENSE for details.
Optimizations:
- Parallel file processing
- Automatic encoding detection
- Processed files versioning
- Execution metrics tracking
Note: For Portuguese version, see README_PT-BR.md