Convert csv to xlsx

RAJESH1960

Banned for repeated rules violations
Joined
Mar 26, 2020
Messages
2,313
Office Version
  1. 2019
Platform
  1. Windows
Hello code experts,
I have this csv file which was converted from pdf. The columns are not in one order to get the data in a columnar view. It will take more than a hour to arrange each line in a particular format. JohnnyL's code has helped me a lot to get the columns in order in less than a second. I am facing one problem in one of the conversions. The code is not able to concatenate the Cheque No. to the Description in 3 different rows and in one of the lines it is not taking the amount. Hence the balances are not matching. I have colored the lines with errors. Need your expertise to correct the code. Thanks.
Conver CSV to XLSX.xlsm
 
Last edited:
As well as an explanation please provide a sample final output file.

PS please but a full stop at the start of this line
.Range("A1").CurrentRegion.Resize(1).Font.Bold = True
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
First of all, the date needs to be corrected in the code.
Alex. The code is giving the right result. As I told you earlier that the problem is in the dates. The voucher type is missing too.
 
Upvote 0
Voucher type means if the Dr. column has value it is Payment else Receipt. In my raw data sheet I do not need Src Row & balance columns headings. As the next code I am going to add to your code is going to select the data from columns in this order from the Raw sheet.
4. Import Bank Single Entry 28.12.2021.xlsm
ABCDEFG
1DateTypeNo.DescriptionNameDebitCredit
Raw
 
Upvote 0
The name column to be inserted in the same cell and is the only column which will be empty.
 
Upvote 0
This is the output of your code. Compare the placement of columns and headings with expected result.
Test 21.02 csv to slsx convertor - Copy.xlsm
ABCDEF
1Src RowTxn DateDescription Dr Amount Cr Amount Balance
23330-11-20210040008700003314:Int.Coll:0 1-11-2021 to 30-11-202 Txn No:S367170891,42,061.002,01,33,776.81
33430-11-2021NEFT_IN:CMS2263255755/0 029/ NEFT SAI PRIYADARSHINI PNB BANK Txn No:S302650277,857.001,99,91,715.81
Raw
 
Upvote 0
Have you tried GWteB's code here, to see if you can get a cleaner starting point ?
Extract data from .PDF
Alex, I tried GWteB's code again. This time I unlocked the file by printing it to pdf. No doubt the code is good, but it will not help me as I am getting most of the data of one row in multiple rows. The pdf file is like in the image.
Book1
ABCDEFGH
584M93083301-12-2020BY CASH -413400TRICHY,VAYALUR ROAD14,250.0020,365.59 Cr.
585S6015278601-12-20203911002100003983 To: 0040005500052250-1,600.006,115.59 Cr.
586S5980166301-12-2020NEFT_OUT:PUNBH20336555-17,700.004,515.59 Cr.
587110/Vaulten Data
588Solu/HDFC0002778/5020000 0555009
589S5968335401-12-2020UPI/033603775068/P2V/9980 661815@ybl/MURUGESH K-8,010.0022,215.59 Cr.
590S5911798601-12-2020UPI/033647103196/P2V/8867-55514,205.59 Cr.
591443318@ybl/PARVEEZ AHMED
592S5861984001-12-2020UPI/033637165261/P2V/6366-1,160.0013,650.59 Cr.
593070245@ybl/HITESH
594GOWDA
Sheet2
 

Attachments

  • pdf file.png
    pdf file.png
    74.3 KB · Views: 3
Upvote 0
I think I will go with your code. It is more than what I asked for. The remaining part is not so tough to finish it manually. I really appreciate for your help. If only you can correct the dates, that is enough.
 
Upvote 0
I will have a look this afternoon my time.
(I can't tell what time zone you are in)

Tell me or show me the steps you are going to do manually and I will try to incorporate them.
A sample final output after applying the additional steps would help.
 
Upvote 0
I will have a look this afternoon my time.
(I can't tell what time zone you are in)

Tell me or show me the steps you are going to do manually and I will try to incorporate them.
A sample final output after applying the additional steps would help.
Did you check the dates error..? That is the only problem.
 
Upvote 0

Forum statistics

Threads
1,215,506
Messages
6,125,194
Members
449,214
Latest member
mr_ordinaryboy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top