Save column headers in a text file (as a comma-separated list) then save data as CSV file into another file and then concatenate both files. Example: FileSave( OutputFileName, "Column A, Column B, Column C\r\n" ) DatabaseSave( "temp.csv", "CSV" , rows ) ConcatEx( "cmd /b copy ", OutputFileName, " + temp.csv", Command ) RunAndWait( Command, "", 0, process ) FileDelete( "temp.csv" ) The created file will contain column headers and can be opened with Excel. : I'm using 24x7 version 3.3.5 to extract data from an : Oracle database and save it to an Excel file to : e-mail to a staff member. Is there an easy way to : add the selected table column names as the first row : of the spreadsheet? Here's a snippet of the code : I'm using to extract and save the data: DatabaseConnect( "axis_PBX" : ) : DatabaseRetrieve( SQL, rows ) : DatabaseDisconnect : isGreater( rows, 0, gotresults ) : // If any results returned, send them via email : If( gotresults, NOTIFY, END ) : NOTIFY: // Save retrieved data in the temporary file : DatabaseSave( OutputFileName , "XLS" , rows ) : END:
|