Key functionalities:
- Reads updated data: Loads updated product data from an Excel file (.xls or .xlsx) and extracts relevant columns ('Code' and 'Qty').
- Preprocesses updated data: Cleans and formats SKU codes ('Code') to ensure consistency.
- Reads exported data: Loads exported product data from a CSV file and extracts relevant columns.
- Preprocesses exported data: Cleans SKU codes ('Variant SKU') and converts non-zero inventory quantities to zero.
- Merges data: Merges updated and exported data based on SKU codes, updating inventory quantities ('Variant Inventory Qty') where applicable.
- Updates published status: Sets the 'Published' column based on inventory quantity values.
- Saves output: Saves the processed data to a new CSV file.
File structure:
The script expects the following files in the same directory:
Updated_Data.xls
orUpdated_Data.xlsx
: Contains updated product data.Exported_Data.csv
: Contains exported product data.
Output:
Exported_Data_Processed.csv
: Contains the updated exported data with merged quantities and published status.Updated_Data_Processed.xls
: Contains the preprocessed updated data.
Dependencies:
os
openpyxl
pandas
re
xlrd