Processing Excel cell values in VB.Net (Please help, its urgent)

Dear Experts,

I need to process attached excel and insert these records into oracle table. I have below code works for me. Moreover excel's cell(A1) is not readable. Using below code I am reading 1st 3 cells:

                Dim cmdExcel = New OleDbCommand("select * from [" & strWSheetName & "$]", connExcel)
                daExcel.SelectCommand = cmdExcel
                daExcel.Fill(ds, "CUSTOMER")
                dTable1 = ds.Tables(0)

                           strCUST_NAME = dTable1.Rows(0).Item(0).ToString()
                     strS_E_DATE   = dTable1.Rows(1).Item(0).ToString()
                     strDISC_DATE  = dTable1.Rows(2).Item(0).ToString()

Its skipping the R1 row and starting from R2. If I move R1-R3 to R2-R4 then it works fine and I get expected output. Moreover I need expected output without any modification.

Source Records format: Refer Attachment
R1 Customer: SYNTEL                  
R2 Period: 2016-12 - 2017-05                  
R3 Discount Date: 2017-05-31 00:00:00                  
R4                  
R5    PartyName      PartyBix      Ranking
R6       AIG                     Insurance      1232
R7       Humana             Helthcare      3242
R8       Athena             Helthcare      3434
R9       BOA             bank              3431

Expected records in Table

Customer      Period      DiscountDate      PartyName      PartyBix              Ranking
Syntel              2017-05      5/31/2017              AIG                      Insurance      1232
Syntel              2017-05      5/31/2017              Humana              Helthcare      3242
Syntel              2017-05      5/31/2017              Athena              Helthcare      3434
Syntel              2017-05      5/31/2017              BOA              bank              3431

Regards
Pratik
sample_excel.xlsx
pratikkange7Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

Is the XL connection  with HDR=YES or HDR=NO?

Regards
0
pratikkange7Author Commented:
Thanks..

Here it is:
       
strExcelConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDestPath & ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'"
        If strExtension = ".xlsx" Or strExtension = ".XLSX" Then
            strExcelConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strDestPath & "; Extended Properties='Excel 12.0;HDR=Yes;IMEX=1'"
        End If
0
Rgonzo1971Commented:
Like I said you have strExcelConn  
 strExcelConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strDestPath & "; Extended Properties='Excel 12.0;HDR=Yes;IMEX=1'"

change to
 strExcelConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strDestPath & "; Extended Properties='Excel 12.0;HDR=NO;IMEX=1'"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pratikkange7Author Commented:
Yes its working now. Its considering the R1 and values are populated.
Thanks a lot. Great Help in-time..
0
pratikkange7Author Commented:
Thanks..God Bless you..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.