I'm trying to assign the date value in this format YYYY-MM-DD hh:mm:ss in a specific cell in excel, I use TCL to open excel and to parse values and finally push values to the cells in excel and finally save it in CSV format,
For example, when i tried to assign 2012-09-10 00:00:00 to a specific cell in excel, i see that excel converts it to 9/10/2012 0:00. Is there any way to turn off the auto formatting option in excel from TCL?
This is my sample code:
proc get_date { } {
set date "2012-09-10 00:00:00"
return $date
}
set application [::tcom::ref createobject "Excel.Application"]
set workbooks [$application Workbooks]
$application DisplayAlerts False
set workbook [$workbooks Open "c:\\test\\dir\\filename.csv"]
set worksheets [$workbook Worksheets]
set worksheet [$worksheets Item [expr 1]]
set cells_worksheet1 [$worksheet Cells]
$cells_worksheet1 Item 5 B [get_date]
$workbook Save
$application Quit