Click here to Skip to main content
15,906,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to read payslip of each type format.I tried to read excel of various type format of Payslip(SalarySlip,PaymentSlip) and insert to in database .But till now I am not able to do it perfectly.Please suggest me best way to read excel of hundreds types payslip
thanks in advance
thanks for reply Sir ..I hereby updating my question
1. I have lots of excel sheet payslip having information like below
Employee Name :Suresh Emp Code --E01
Bank Ac/No :1564564654
   BASIC   | 65,800.00  |   PT       | 200,00
   HRA     | 500.OO     |   PF       |  1500

another payslip
Employee Name :Rajesh Emp Code --D11
   Bank Ac/No :456465654
   BASIC     25,800.00  |   PT      | 200,00
   HRA          700.OO  |  PF       |  1500

Employee Name :Amol Emp Code --AP002
   Bank Ac/No :3212313
   BASIC     23,600.00  |   PT       200,00
   HRA          700.OO  |  PF       |  1500

  Employee Name :Ojas Emp Code --OP0334
  Bank Ac/No :78787878
  BASIC HRA     23,600.00 700  |   PT PF | 200,00 1500
                           |  PF       |  1500

now this payslip example in this data not merged in one excel .In another paslip data is merged but type of Merging is different is different in every last three palyslip .
Now Steps Taken By
1. I import this data in datatable in C# programming using oledb connection.
2. Then I tries to read every cell data and insert into payslip table.But problem as you see here last three payslip cell values merged in different formats . In Rajesh payslip cells Earning and with its amount merged in single cell .
Whereas in Amol payslip First head value of Deduction column merged with its amount.In Ojas payslip earning heads merged with each other and values in different cell.
Like this I saw lots of payslip I need to find best way to capture maxmimum data from these type excel with efficiently and good performance .
Will you please suggest ?If you want to see payslip image then I can show images also for this i need your email id.Thanks again....

What I have tried:

For this I asked questions on this forum .Analysis based on this answers i made algorithm and created logic for this .But even after creating alogorithm I become unsuccessfull in some part of reading salaryslip specially when excel shell data merged .
Updated 23-Sep-16 15:58pm
OriginalGriff 22-Sep-16 2:26am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
So perhaps if you show your relevant code fragments, perhaps some of your inputs, and explain exactly what happens it might help?
Use the "Improve question" widget to edit your question and provide better information.
sp_suresh 22-Sep-16 3:22am    
Hello sir ,
Please see updated question ...

1 solution

I dont see a huge problem

write a hierarchical scanner/parser (Im thinking 'recursive descent', that may not be entirely correct)

a) parse out blocks of 'Employee Name' data to single 'payslip' collections of lines
b) have a scanner/parser that then starts breaking down the collections of lines by (almost) line type
bi) employee name
bii) bank account
biii) BASIC line
biv) HRA line
bv) BASIC HRA line
bvi) any 'leftovers'
c) have an error bucket, that anything fails goes into maybe for manual action

you could likely encapsulate that in a payroll file object that creates payslip objects each of those objects knows how to handle its own content

Im sort of tempted to say as I'd do in days of old, write an 'external' grammar that described the file, and a parsing engine that reads in the grammar, and uses that to pull apart the file - and that may well work here, but it could also be overkill - it really depends how more complicated the file format gets or if you need extensibility - once you've removed a lot of the 'guff' spaces, ---- lines etc in the data there isnt much left - some of those lines for excample you could pull apart with Regexes
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900