Mr_Bro
6 years agoFrequent Contributor
Write Conent To Excel using ADO connectio
Hi team,
im trying to write some content to excel using ADO connection.
can any one help me in achieving the same.
im using Python and below is the sample code where i m trying to write the content to excel.
def writeDataToExcel(): strSheet = 'over' filepath = r'C:\Users\sathishkumark\Desktop\Test.xlsx' ConnectionString = 'Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ='+filepath+';ReadOnly=0;Extended Properties=Excel 12.0 Macro;HDR=YES;' objExcel = ADO.CreateConnection() objExcel.ConnectionString = ConnectionString objExcel.Open() objRS = ADO.CreateRecordset() strQuery = "update ["+strSheet+"$] set col1 = 'sda';" objRS.Open (strQuery, objExcel, 3, 3) objExcel.Close() objExcel.Close()
Kind Regards,
Sathish Kumar K
Hi Mr_Bro,
Please refer to the following article - it contains an example in Python:
https://smartbear-cc.force.com/portal/KbArticleViewer?name=Write-data-to-MS-Excel&sp=testcomplete