Click here to Skip to main content
14,392,909 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi can any1 plz suggest me, I'm in need to export data from excel sheet to sql database from a predefined path daily 1PM using c#. how to do it?
Posted
Updated 23-Feb-14 19:58pm
v2

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Hi,

These links should help you.

http://technet.microsoft.com/en-us/library/ms140052.aspx[^]

http://stackoverflow.com/a/3474783/2671089[^]

Write back if you are stuck.

[Please accept/up-vote answers or solutions that work for you to encourage participation]
   
Comments
DaisyArun 24-Feb-14 1:09am
   
Hi thanks for your Support, But i Need to schedule a task to do this process? let me know how to do it.
CoderPanda 24-Feb-14 1:11am
   
Quoting from the same SO discussion...

"...you would have to step through the wizard once manually, to set everything up. Once done, you can save the steps as a SSIS package into SQL Server and have that executed at any given time, by scheduling it in SQL Agent. Works on any machine - 32 or 64 bit - no problem."
DaisyArun 24-Feb-14 1:31am
   
Is it possible to import data from Excel sheet to SQL database at scheduled time using c#
CoderPanda 24-Feb-14 1:34am
   
Yes, sure, but in that case you will have to write a windows service that runs at scheduled times and reads excel files from the desired location and imports into sql server. This will be certainly more effort than having a SSIS package.
DaisyArun 24-Feb-14 1:35am
   
Can you please suggest me how to do that. I'm completely unaware about these concept. Thanks in advance
CoderPanda 24-Feb-14 1:38am
   
Unfortunately I won't be able to write code for you, but here are steps at a broad level, I am sure if you google you can figure out the way:
1. Write a console app
2. In it, try to read your excel file
3. Identify your DB tables and columns and how they map to the columns in the excel
4. Insert data from your excel into the DB
5. Now if everything works all right, then add a new task scheduler to windows and have this console exe invoked at specified intervals
DaisyArun 24-Feb-14 1:39am
   
Thank u very much for your support. i'll follow those steps..

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




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