Click here to Skip to main content
13,049,233 members (71,927 online)
Rate this:
Please Sign up or sign in to vote.
See more: , +
Hey Guys,

i've a serious situation,

My Client gives me an excel file for some data.

The excel file is exported from Crystal Report of another application that i don't have

autorization to edit in it.

He wants me to add a page to my website that could upload and insert these data to my website

because there might be another Excel files to upload and insert.

I've tried alot to find some way to get data in that excel file but i've faced these problems:

1- The Columns in the excel file are interacted in some studpid way i don't know it.

2- There is a header in the excel file that contains useless data.

So i wish if any one have an ideas to do that.

I've prepared a template file to the Excel file (data starts from row no. 15)
Col14	Col13	Col12	Col11	Col10			Col9	Col8	Col7		Col6		Col5	Col4	Col3		Col2	Col1
98	 	 	 				0	0	0		0			655	 		Name 1	123
987	 	 	 				0	0	0		0		asd	654	 		Name 2	234
987987	 	 	 				0	0	0		0		zxc	897	الهند		Name 3	45
999	 	 	 				0	0	0		0		aqwe	888	مصر		Name 4	645
8741	 	 	 				0	0	0		0		vdfg	6555	الاردن		Name 5	76

HERE is the Link on Mediafire

Thanks in Advance
Posted 28-Apr-13 23:57pm
Updated 29-Apr-13 0:31am
Maciej Los255.3K
Maciej Los 29-Apr-13 6:34am
It does not work like that! No one want to download any file.
Please, shrotly describe data structure and provide useful information about your issue...

What have you done so far? Where are you stuck?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Try below code...
In below code, u will read Excel data and can use insert Datatable or u can use as show in below....

Select the ACCESSExcel Table INTO an Excel Spreadsheet
                //SELECT INTO command                
                string cnStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + AccfilePath +
                   ";Persist Security Info=False";
                using (connectionToDatabase)
                    //Give the Export Table (destination) a Name
                    //baseTblName = dt.TableName;
                    //Generate the SQL string to SELECT * INTO the NEW table in destination
string selectcmd = "SELECT * " +
               "FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0'," +
               "'Excel 12.0;Database=" + EXCELfilpath + ";IMEX=1'," +
               "'SELECT * FROM ["+sheetName+"$]')";

                    using (OleDbCommand createCmd = new OleDbCommand(selectcmd, connectionToDatabase))
AmrDeif 30-Apr-13 2:58am
Thanks Kushal.patil121 for your reply
but i've solved it my self
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

thanks Guys i've solved it my self

i've convinced my client to put the data in some kind of a template file

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 30 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100