Wednesday, 15 January 2014

c# - Bulk Copy of multiple Excel files to database -



c# - Bulk Copy of multiple Excel files to database -

i need read info of particular range in excel file , upload them in database.

the required info not start @ a1 cell instead, start @ a15 , a14 header row columns. there 7 columns headers.

(i tried read cells via "get_range" option)

we need read info in each cell , row row update in database.

there thousands of files of same type in specific folder.

i trying accomplish c# console app because 1 time job.

here reply found.

step 1 : loop through each file in source directory.

step 2 : add together excel interop reference. , create excel application class object, , workbook, , range(for used range).

step 3 : utilize range() function , read rows. (since solution specific problem, start , end ranges of rows , columns known)

step 4 : each read row can constructed string till end of file. or insert can done after reading each row.

step 5 : connection string , create sqlconnection object perform insert. improve utilize transaction-commit.

done. all.

c# database excel bulkinsert

No comments:

Post a Comment