Page 1 of 1

Exporting output to Excel 2007 - workbook is empty

Posted: Thu Mar 12, 2015 4:49 pm
by 0101
I'm using SPSS verison 22 and I am using the OUTPUT EXPORT and CREATESHEET commands to output a custom table to an Excel file, using the XLSX extension (i.e., Excel 2007 +).

My code ran fine when using the .XLS extension (Excel 2003). But with the XLSX extension, if the workbook doesn't exist, I get the usual warning that it does not exist. The code creates the workbook (as it should), but it does not create the specified worksheet and does not export the output. The workbook is created but is empty. Any suggestions (other than manually creating the workbook ahead of time)?

Code: Select all

output export NAME=DQ
  /CONTENTS  EXPORT=VISIBLE  LAYERS=PRINTSETTING  MODELVIEWS=PRINTSETTING
	/XLSX DOCUMENTFILE='DQ\MyWorkbook.xlsx'
	 OPERATION=CREATESHEET SHEET=YYstr+Monthstr.

Exporting output to Excel 2007 workbook is empty

Posted: Sat Apr 15, 2017 7:41 pm
by Genasn
This is about as simple as you can get. Create an excel object, and use the CopyFromRecordset on a specific range
CODE