SPSS File I/O

SPSS is capable of handling most file formats, including proprietary ones. But only god can help you if you use characters outside ANSI ASCII.


Excel

To import from an Excel spreadsheet:

get data
  /type=xlsx
  /file="path/to/file"
  /sheet=name "Sheet1"
  /cellrange=full
  /readnames=on
  /assumedstrwidth=32767.

To export into an Excel spreadsheet:

save translate
  /outfile="path/to/file"
  /type=xlsx
  /version=12
  /map
  /replace
  /fieldnames
  /cells=values
  /keep=VARLIST.

It is not possible to export into an existing spreadsheet and add a sheet.


CSV

To import from a CSV file:

get data
  /type=txt
  /file="path/to/file"
  /delimiters=","
  /firstcase=1
  /variables=
  VAR1 A1
  VAR2 F2.

It is necessary to declare all variables and their formats on import.

To export into a CSV file:

save translate
  /outfile="path/to/file"
  /type=csv
  /map
  /replace
  /fieldnames
  /cells=values
  /keep=VARLIST.


Tab-Delimited

To import from a tab-delimited file:

get data
  /type=txt
  /file="path/to/file"
  /delimiters="\t"
  /firstcase=1
  /variables=
  VAR1 A1
  VAR2 F2.

It is necessary to declare all variables and their formats on import.

To export into a tab-delimited file:

save translate
  /outfile="path/to/file"
  /type=tab
  /map
  /replace
  /fieldnames
  /cells=values
  /keep=VARLIST.


CategoryRicottone