Ask a Question

Write Conent To Excel using ADO connectio

SOLVED
K_Sathish_Kumar
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

Regards,
Sathish Kumar K
1 ACCEPTED SOLUTION

Accepted Solutions
TanyaYatskovska
Community Manager

Re: Write Conent To Excel using ADO connectio

Hi @K_Sathish_Kumar,

 

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


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

1 REPLY 1
TanyaYatskovska
Community Manager

Re: Write Conent To Excel using ADO connectio

Hi @K_Sathish_Kumar,

 

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


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

cancel
Showing results for 
Search instead for 
Did you mean: