Export content of data editor to a specified sheet of an existing Excel workbook
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | * Export the active data file to a specified sheet of an existing Excel workbook. * Solution posted by Alex Vinogradov to SPSSX-L list on 2004/03/14. * Note 1: * the DSN connect string may vary from system to system. To obtain the correct * string, import data from an excel file using the FILE>OPEN DATABASE>NEW QUERY and * use the DSN connect string generated by the system. * Note 2: * In the code below if you replace /REPLACE by /APPEND, the content of the data editor is added * at the end of the specified wooksheet. GET FILE='c:\\program files\\spss\\employee data.sav'. SAVE TRANSLATE /CONNECT='DSN=Excel Files;DBQ=C:\\temp\\myexcel.xls;DriverId=790;MaxBufferSize=2048;PageTimeout=5;' /TABLE="mysheet1" /TYPE=ODBC /REPLACE. SELECT IF $CASENUM<40. SAVE TRANSLATE /CONNECT='DSN=Excel Files;DBQ=C:\\temp\\myexcel.xls;DriverId=790;MaxBufferSize=2048;PageTimeout=5;' /TABLE="mysheet2" /TYPE=ODBC /REPLACE. |
Related pages
...