Copy data from one Excell sheet to another Excell Sheet using sql server 2000

Posted by Mahendrabasutkar under Sql Server on 6/10/2011 | Points: 10 | Views : 2189 | Status : [Member] | Replies : 3
How to copy data from one Excell sheet to another Excell Sheet using sql server 2000.
Excell sheet should be in 97-2003 format

Thanks&Regards
mahendrabasutkar




Responses

Posted by: Robin_ahuja2008 on: 6/15/2011 [Member] Starter | Points: 25

Up
0
Down
You can do it by VBA

Copying a worksheet in VBA is easy. If it is going into the same workbook
then use this

Sheets("Master").copy

Sheets("Sheet1").Copy after:=Sheets(Sheets.Count)
Set NewSht = ActiveSheet


for copying multipel sheets

for i = 1 to sheets.count
Sheets(i).Copy after:=Sheets(Sheets.Count)
Set NewSht = ActiveSheet

next i



OR we have some c# code
 string src = @"Book1.xlsx";

string dst = @"Book2.xlsx";

object missing = Missing.Value;

ApplicationClass app = new ApplicationClass();
WorkbookClass wb1 = (WorkbookClass) app.Workbooks.Open(src, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing,missing);
WorkbookClass wb2 = (WorkbookClass)app.Workbooks.Open(dst, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing);

Worksheet sheet1 = (Worksheet) wb1.Worksheets["Sheet1"];
Worksheet sheet2 = (Worksheet)wb2.Worksheets["Sheet1"];
try
{
sheet1.Copy(sheet2,missing );
}catch (Exception ex){
//
}
finally{
app.Quit();
}


Regards,
Robin Ahuja

Mahendrabasutkar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakn2 on: 6/17/2011 [Member] Starter | Points: 25

Up
0
Down
try this

http://stackoverflow.com/questions/375991/import-excel-spreadsheet-columns-into-sql-server-database

Thanks&Regards
LakshmiNarayana Nalluri.

Mahendrabasutkar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sriramnandha on: 5/20/2012 [Member] Starter | Points: 25

Up
0
Down
U CAN USE DTS OR SSIS ,VBA
REGARDS

sriram

Mahendrabasutkar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response