Giter VIP home page Giter VIP logo

html-table-to-csv's Introduction

HTML to CSV Converter

This project provides a command-line tool to convert HTML tables to CSV files. The script reads an HTML file containing tables and extracts relevant data, which is then saved to a CSV file. This script is specifically tailored to extract pertient information from material list reports generated by Eagle Metal software.

Features

  • Parses HTML files and extracts table data.
  • Aggregates and cleans the data.
  • Converts lineal footage measurements from feet and inches to inches for aggregation, then back to feet and inches.
  • Outputs the cleaned and aggregated data to a CSV file.

Requirements

  • Python 3.x
  • beautifulsoup4 library
  • pandas library

Installation

Using the Executable

To use the pre-built executable, follow these steps:

  1. Download the html_to_csv.exe file from the dist directory.
  2. Place the executable in the desired directory on your Windows machine.

Building from Source

If you prefer to build the executable from the source code, follow these steps:

  1. Clone the repository:

    git clone https://github.com/dnakitare/html-to-csv.git
    cd html-to-csv
  2. Install the required libraries:

    pip install -r requirements.txt
  3. Create the executable using PyInstaller:

    pyinstaller --onefile html_to_csv.py

    The executable will be generated in the dist directory.

Usage

Using the Executable

  1. Open Command Prompt.

  2. Navigate to the directory containing the executable and your HTML file.

  3. Run the executable with the HTML file as an argument:

    html_to_csv.exe input.html
  4. The script will generate a CSV file with the same name as the input file, but with a .csv extension.

Using the Python Script

  1. Open Command Prompt.

  2. Navigate to the directory containing the Python script and your HTML file.

  3. Run the script with the HTML file as an argument:

    python html_to_csv.py input.html
  4. The script will generate a CSV file with the same name as the input file, but with a .csv extension.

Example

Given an HTML file sample.html:

<!DOCTYPE html>
<html>
<head>
    <title>Sample HTML</title>
</head>
<body>
    <table>
        <tr>
            <th>SKU</th>
            <th>Name</th>
            <th>Quantity</th>
        </tr>
        <tr>
            <td>12345</td>
            <td>Wood Plank</td>
            <td>10</td>
        </tr>
        <tr>
            <td>67890</td>
            <td>Plywood</td>
            <td>5</td>
        </tr>
    </table>
</body>
</html>

Running the command:

html_to_csv.exe sample.html

Will generate a CSV file sampel.csv with the following content:

Lumber Size,Quantity,Board Footage,Lineal Footage
Wood Plank,10,,10' 0"
Plywood,5,,5' 0"

License

Distributed under the Apache-2.0 license. See LICENSE for more information.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Issues

If you encounter any issues, please open an issue on GitHub.

Acknowledgements

This project uses the following libraries:

html-table-to-csv's People

Contributors

dnakitare avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.