A utility to convert COMINTEXT formatted files into CSV format using a reference Excel file.
./comintext2csv data [-r reference.xls] [-o output.csv]data: A.txtfile or a folder with.txtfiles-r: (Optional) Excel file that defines layout. If omitted, the program will try to find an.xlsor.xlsxfile with a similar name in the same directory.-o: (Optional) Output CSV file path (only for single file mode). If omitted, the program will use the base name of the data file.
Convert one file with a reference layout
./comintext2csv ./legdat.txt -r LEGDAT\ Extract\ Data\ Format.xls -o result.csvConvert one file and let the script find the layout automatically
./comintext2csv ./legdat.txtConvert all .txt files in a folder. The resulting CSV files will be placed in your working directory.
./comintext2csv folder/A prebuilt macOS binary is provided. It must be kept in the same directory as the _internal directory. To mark it as executable, run the following command:
chmod +x dist/comintext2csvIf you want to make this command available in your terminal, run the following command:
echo 'export PATH="$PATH:'"$(realpath dist)"'"' >> ~/.profile
source ~/.profileIf you move your directory, this will break.
You will have to run the .py script if you are using Windows.
- Ensure you have python3 installed
- Install the dependencies with
pip install pandas openpyxl - Run the script with
python comintext2csv.py ...