Ask a Question

Write Conent To Excel using ADO connectio

SOLVED
Mr_Bro
Champion Level 0

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

1 REPLY 1
TanyaYatskovska
SmartBear Alumni (Retired)

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

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



cancel
Showing results for 
Search instead for 
Did you mean: