GithubHelp home page GithubHelp logo

yomajo / parse-post-codes Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 392 KB

Parsing and loading (on/off) postal codes used for barcode generation provided in txt file from within Excel environment

Python 42.33% VBA 57.67%
python vba excel txt python-vba stdout-stream barcode barcode-generator

parse-post-codes's Introduction

Parse Post Codes

Description & Usage

This a part of a large VBA Project I was working on, that generates Invoices and Export Declarations from exported Ebay CSV Files. Each Export Declaration uses barcode, that is a special font used on postal code. Postal Codes are provided by Post Office in txt format.

Example of first 4 codes in text file:

"UA759883946LTUA745082482LTUA860409989LTUA432531574LT"

Postal code structure: 'UA' + 9 dec symbols + 'LT'

Usage

Main Program.xlsm works as GUI. Screenshot from "Main" sheet in Main Program.xlsm: Parse Post Codes Excel GUI screenshot

  1. On workbook open, command prompt is instantiated and where python is executed, capturing output to hidden sheet "PyPath" in A1 cell.
  2. Reset button simply cleans contents from Main worksheet
  3. Use New Code Postal_Codes_Manager.xlsx, copies first free code and moves it to "Expired Codes" sheet
  4. Add New Postal Codes launches txt_to_excel.py, which converts txt file contents to list and starts appending it from first free row in A column, "Free Codes" sheet, Postal_Codes_Manager.xlsx workbook

Python to parse codes and load to workbook

Script splits txt continuous content to list each 13 symbols (fixed) and via openpyxl lib. pushes new codes in Postal_Codes_Manager.xlsx

Python to generate postal codes

Not to bother Post Office when still in development, I postal codes were still needed to work with, so output_entropy.py was written to generate identical file of post codes. It generates txt file with codes_count (Global variable inside script) number of postal codes.

Example file.

VBA Modules

All VBA part modules have been exported for inspection and are in VBA Modules

Requirements

  • Python 3.7.3+
  • openpyxl (pip install openpyxl)
  • Python added to PATH
  • In order to use barcode, add provided font to C:\Windows\Fonts.

Tested only on Windows machine

Installation

Simply download both workbooks and python files and proceed with Main Program.xlsm as GUI.

parse-post-codes's People

Contributors

yomajo avatar

Watchers

 avatar  avatar

parse-post-codes's Issues

Verify Post Codes before being added

Currently, VBA does not get feedback from VBA about adding codes txt_to_excel.py sub-program succession.

capturing command prompt output (print statements) is one way to achieve this

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.