Excel Upload Feature Documentation
===============================

This feature allows users to upload Excel or CSV files, preview the data, and import it into database tables.

Files Included:
- excel_upload.php: Main upload interface
- process_excel_upload.php: Handles file processing and database import
- download_sample_excel.php: Generates sample Excel files for specific tables
- composer.json: Dependency management file

Installation Instructions:
1. Install Composer if not already installed: https://getcomposer.org/
2. Navigate to the milk365 directory in your terminal/command prompt
3. Run the following command to install the required library:
   composer install
   OR
   php composer.phar install

If you don't have Composer installed, you can still use the feature with CSV files only.
Simply rename your Excel files to .csv format and upload them.

Features:
- Upload .xlsx, .xls, and .csv files
- Preview data before importing
- Map columns to database tables
- Option to treat first row as headers
- Download sample Excel files for each table
- Transaction-based imports for data integrity

Usage:
1. Go to excel_upload.php in your browser
2. Select an Excel or CSV file
3. Choose the target database table
4. Confirm if the first row contains headers
5. Click "Upload & Preview" to see the data
6. Review the data and click "Confirm Import to Database" to save

Security:
- All database operations use prepared statements
- File uploads are validated for proper extensions
- SQL injection protection via parameterized queries