Package: parse2excel
Parse2ExcelSimple CLI tool parsing text files with TextFSM and export to SQLite and Excel with own configuration file, also within configuration file custom SQLite commands can be executed to create custom tables.RequirementsPython >= 3.9For Windows, select theAdd Python 3.x to PATHcheckbox during installation.InstallationOption 1:From Python Package Index (PyPI) Repo:pip install parse2excelOption 2:Download project ZIP file and run below command:pip install parse2excel-X.zipInstallation CheckAfter installationparse2excelcommand added toSystem Pathand can be executed from any path easily as below:> parse2excel -h
usage: parse2excel [-h] [configfile]

positional arguments:
  configfile   config yaml file path [e.g. srlinux_config_1.yaml] (OPTIONAL default: file=config.yaml, folder=P2E_CONFIGS)

options:
  -h, --help  show this help message and exitUsageSimple UsageRunparse2excelcommand withConfig File PathORwithout argument "config.yaml" fileused (single config file) ORwithout argument "P2E_CONFIGS" Folderused (multiple config files in folder) from any path after that check excel/SQLite output files in working directory.parse2excel <Config_File_Path>Config fileThere are fourtypeoptions in YAML config file:textfsm:Parse text files in folder with TextFSM template and export excel/SQLite.sqljoin:Run "SELECT" SQLite command and export excel/SQLite. (Python function supported) (Any SQLite command run with "sqlcommand_run")sqlfunction:Create SQLite Python functions for allsqljoinparts.excel:Import Excel file and convert to SQLite.Example config.yaml file:### Simple textfsm type, parse device config files in folders# and create sqlite table & excel sheet (if NOT include "excel_export: none")##-type:textfsmdb_name:my_p2e_exceltable_name:my_interface_sheet# excel_export: nonefolders:-device_config_FOLDERtemplate:|Value Required Interface (\S+)Value Interface_Description (\S+)Value Interface_Ip (\S+)Value Interface_Mask (\S+)Start^interface ${Interface} -> BeginBegin^ description ${Interface_Description}^ ipv4 address ${Interface_Ip} ${Interface_Mask}^! -> Record Start### Simple sqljoin type, create table with select command and OPTIONAL function.# Create also excel sheet (if NOT include "excel_export: none")##-type:sqljoindb_name:my_p2e_excelnew_table:SecGW_CERTsqlcommand:select removetxt(Filename), Cert_Name, Cert_Start, Cert_End from certificatefunctions:-|def removetxt(d):return d.replace('.txt','')### add python function for all sqljoin parts# after that no need to add function for sqljoin explicitly.##-type:sqlfunctionfunctions:-|def removetxt(d):return d.replace('.txt','')### create "ports_with_vlan_desc" custom table with "SQLite Select" commands# With "LEFT JOIN" add "vlan description" to ports table on match "Vlan Number"##-type:sqljoindb_name:my_p2e_excelnew_table:ports_with_vlan_descsqlcommand:|SELECTports.*,vlans.Vlan_Desc_NameFROMportsLEFT JOIN vlans ON (ports.Hostname = vlans.HostnameAND ports.Interface_Vlan = vlans.Vlan_Number)### only run any sqlite command for debug, delete table etc.##-type:sqljoindb_name:my_p2e_excelsqlcommand_run:select Service_ID from vprn_w_x### import excel file to sqlite db-table##-type:exceldb_name:from_excelexcel_file:excel_file.xlsx# OPTIONAL, specify excel sheets# excel_sheets:#   - Sheet1Output Excel File ExampleAs below example in seperate sheets "ports", "vlans" and "ports_detail" tables are created with"textfsm type".In "vlans" sheet, "Filename - Hostname - Vlan Number - Vlan Description" are headers with multiple devices data.