Troubleshooting creating an Excel file in TestComplete (using Python)
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Troubleshooting creating an Excel file in TestComplete (using Python)
I am pretty well using the standard sample code from the main TestComplete site.
def writeExcel():
# https://support.smartbear.com/testcomplete/docs/testing-with/working-with-external-data-sources/exce...
# https://support.smartbear.com/testcomplete/docs/testing-with/working-with-external-data-sources/exce...
#curTime = aqDateTime.Now()
emailDataFilename = r'C:\foo\bar\redacted.xlsx'
Log.Message(aqString.Format("Data file name is %s.",emailDataFilename))
if (aqFile.Exists(emailDataFilename)):
excelDataFile = Excel.Open(emailDataFilename)
else:
# Create a new Excel file and add a new empty sheet to it
Log.Message(aqString.Format("The %s file does not exist and will be created.", emailDataFilename))
excelDataFile = Excel.Create(emailDataFilename)
excelSheet = excelDataFile.AddSheet("Sheet1")
The if/else logic works fine, but nothing happens in terms of file activity.
You might not like AI, but it doesn't care about you.
Solved! Go to Solution.
- Labels:
-
Desktop Testing
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Correct. When I set watches in the code, I can see objects being created, but the new file is not being created. Or updated, if I put in a file with the name in the script.
You might not like AI, but it doesn't care about you.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @DSmachineWorld -
excelFile.Save()
Please add this and it should be fixed! Let me know if you have further questions.
Emma
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you! I knew I missed something elementary!
You might not like AI, but it doesn't care about you.
