Exporting output to Excel 2007 - workbook is empty

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

0101
Posts: 52
Joined: Fri Mar 04, 2011 9:42 pm

Exporting output to Excel 2007 - workbook is empty

Postby 0101 » Thu Mar 12, 2015 4:49 pm

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.
Genasn
Posts: 3
Joined: Thu Apr 13, 2017 1:17 pm

Exporting output to Excel 2007 workbook is empty

Postby Genasn » Sat Apr 15, 2017 7:41 pm

This is about as simple as you can get. Create an excel object, and use the CopyFromRecordset on a specific range
CODE

Who is online

Users browsing this forum: No registered users and 2 guests

cron