Skip to content

EazyNick/XLwings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XLwings Excel Automation Project

Overview

This repository contains Python scripts for automating Excel operations using the xlwings library. It includes a main script (main.py) for comparing data between two Excel files and a utility class (excel_handler.py) for handling Excel-specific operations.

Files

1. main.py

This script is the entry point for the project. It compares two Excel sheets and updates one file based on matching data from another.

Key Features:

  • Compares two Excel files based on specific column values.
  • Updates target file cells with values from the base file when matches are found.
  • Ensures proper workbook handling and cleanup.

Usage:

python main.py

2. excel_handler.py

This file defines the ExcelHandler class, which simplifies common Excel operations such as reading, writing, and searching cells.

Key Features:

  • Open, read, and write Excel files.
  • Retrieve row and column data efficiently.
  • Search for specific values within a sheet.
  • Check if a cell is empty.

Requirements

  • Python 3.8+
  • xlwings library

Installation

  1. Clone this repository:
    git clone <repository_url>
    cd <repository_name>
  2. Install the required dependencies:
    pip install xlwings

How to Run

  1. Ensure the paths to your Excel files are correctly set in main.py:
    file1_path = r"D:\\path\\to\\base.xlsx"
    sheet1_name = "Sheet1"
    file2_path = r"D:\\path\\to\\target.xlsx"
    sheet2_name = "Sheet2"
  2. Execute the script:
    python main.py

Example Workflow

  1. The script reads data from a base Excel file (base.xlsx) and a target Excel file (target.xlsx).
  2. It compares specific columns (e.g., Levels 1, 2, 3) to identify matches.
  3. When a match is found, a value from the base file is written to the target file in a specified column.

Contributions

Feel free to open issues or submit pull requests if you would like to contribute to this project.

License

This project is licensed under the MIT License.


Contact

For questions or feedback, please reach out to the repository maintainer.

About

엑셀 컨트롤

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages