Excel Data Import

Import solar cell purchase data from Excel file into database

Excel File Location:
/var/www/fullsolar.mac.in.th/resources/CELL.xlsx

Method 1: Python Import Script (Recommended)

1
Install Python Dependencies
pip3 install openpyxl pymysql
2
Run the Import Script
cd /var/www/fullsolar.mac.in.th
python3 import_excel.py
Note: The script will automatically map Excel columns to database fields and handle duplicates.

Method 2: PHP Import (Web-based)

1
Install PHP Dependencies
cd /var/www/fullsolar.mac.in.th
bash install-composer.sh
2
Upload Excel File (Optional)

The file CELL.xlsx is already in the resources folder

3
Run Import via Web Interface

Access: import_excel_web.php

Expected Excel Column Format

The import script will automatically detect and map these columns:

Excel Column (Examples) Database Field Required
PO Number, Purchase Order, PO purchase_order_no Yes
Supplier, Supplier Name supplier_id/name Optional
Cell Type, Cell Name cell_type_id/name Optional
Date, Purchase Date, วันที่ purchase_date Optional
Quantity, Qty, จำนวน quantity Yes
Price, Unit Price, ราคา unit_price Yes
Invoice, Invoice No invoice_no Optional
Batch, Batch No, Lot batch_no Optional
Warehouse, Location, คลัง warehouse_location Optional
Status, สถานะ quality_status Optional
Notes, Remark, หมายเหตุ notes Optional
Tip: The script supports both English and Thai column names and will try to match them automatically.

Quick Import Command

Run this single command to import your data:

cd /var/www/fullsolar.mac.in.th && python3 import_excel.py