I have an excel file which contains 7 column with column heading.
I want to create each text file with same heading by checking data of column D for same data.
Text file name will be from column G depends on column D.
For each row text file contain one line and in last line will be "Total = Number of row come from excel file excluding heading.
Just Column A,B,C,E, & F data will go to text file.

Example of Excel File:

A B C D E F G
Number Name account code i-date e-date 002-Corporate
5689 adcd 00234015931 002 23/03/2013 31/03/2023 003-General
5699 pdcd 00334015931 003 23/03/2013 31/03/2023
5669 ldcd 00234015931 002 23/03/2013 31/03/2023
5679 kdcd 00334015931 003 23/03/2013 31/03/2023
5629 mdcd 00234015931 002 23/03/2013 31/03/2023

Example of Text File:

002-Corporate.txt

Number Name account i-date e-date

5689 adcd 00234015931 23/03/2013 31/03/2023
5669 ldcd 00234015931 23/03/2013 31/03/2023
5629 mdcd 00234015931 23/03/2013 31/03/2023

Total account = 3