spss data to excel sheets export

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

spss data to excel sheets export

Mario Giesel
Hi list, 
is there an Python solution for this task?
SPSS data are to be exported in ONE excel document - but different variables / cases for different sheets. 
 
Thanks a lot,  Mario 

__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.
http://mail.yahoo.com
Mario Giesel
Munich, Germany
Reply | Threaded
Open this post in threaded view
|

Re: spss data to excel sheets export

Jon K Peck

There is no canned Python solution for this, although you could construct something with the xlrd, xlwt third-party Python packages.  The easiest solutions otherwise might be something like this:
- Do SAVE TRANSLATE for each specification to a separate xls file.
- Use Excel VBA to open each file and move the relevant sheet into the same file.

You could make this a little tidier by writing all the outputs to a single Access database and then having Excel pull every table in that database.  Or at least writing a manifest file that would contain a list of the file names to merge.

You can see example Basic code for merging separate xls files in the Excel Export package available from SPSS Developer Central, www.spss.com/devcentral.  That package handles output tables, but the code for merging the Excel files might be relevant.

HTH,
Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435



From: Mario Giesel <[hidden email]>
To: [hidden email]
Date: 03/26/2010 07:36 AM
Subject: [SPSSX-L] spss data to excel sheets export
Sent by: "SPSSX(r) Discussion" <[hidden email]>





Hi list,  
is there an Python solution for this task?
SPSS data are to be exported in ONE excel document - but different variables / cases for different sheets.  
 
Thanks a lot,  Mario  

__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.
http://mail.yahoo.com

Reply | Threaded
Open this post in threaded view
|

Re: spss data to excel sheets export

Albert-Jan Roskam
Hi Mario,

I wrote this a while ago: http://python.pastebin.com/8mp62Zq0
It reads all sheets of an excel file, turns it into one xls file and saves that file to sav.
Although it doesn't do exactly what you want, but you may be able to use it to create the script that you need.

Cheers!!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the face of ambiguity, refuse the temptation to guess.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

--- On Fri, 3/26/10, Jon K Peck <[hidden email]> wrote:

From: Jon K Peck <[hidden email]>
Subject: Re: [SPSSX-L] spss data to excel sheets export
To: [hidden email]
Date: Friday, March 26, 2010, 2:56 PM


There is no canned Python solution for this, although you could construct something with the xlrd, xlwt third-party Python packages.  The easiest solutions otherwise might be something like this:
- Do SAVE TRANSLATE for each specification to a separate xls file.
- Use Excel VBA to open each file and move the relevant sheet into the same file.

You could make this a little tidier by writing all the outputs to a single Access database and then having Excel pull every table in that database.  Or at least writing a manifest file that would contain a list of the file names to merge.

You can see example Basic code for merging separate xls files in the Excel Export package available from SPSS Developer Central, www.spss.com/devcentral.  That package handles output tables, but the code for merging the Excel files might be relevant.

HTH,
Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435



From: Mario Giesel <[hidden email]>
To: [hidden email]
Date: 03/26/2010 07:36 AM
Subject: [SPSSX-L] spss data to excel sheets export
Sent by: "SPSSX(r) Discussion" <[hidden email]>





Hi list,  
is there an Python solution for this task?
SPSS data are to be exported in ONE excel document - but different variables / cases for different sheets.  
 
Thanks a lot,  Mario  

__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.
http://mail.yahoo.com