« Return to Thread: ODBC Query that returns a file?

using export to excel python program in a python progam not spss program block

by Pirritano, Matthew-2 :: Rate this Message:

Reply to Author | View in Thread

Some parts of this message have been removed. Learn more about Nabble's security policy.

Listers,

 

Can I use the following python program which comes with spss to export output to excel from a python program. Just prior to this syntax I have an spss.submit statement that results in an spss graph. Can this graph then cross over to the python program? Does that make sense? The graph is created in the unseen spss process, can I then maninpulate it with python? Like export it to excel?

 

Thanks in advance,

matt

 

 

import SpssClient, sys

               

#ExportToExcel.py

SpssClient.StartClient()

OutputDoc = SpssClient.GetDesignatedOutputDoc()

OutputDoc.ClearSelection()

# Create a new workbook and export all charts to a worksheet

# named Utilization.

OutputDoc.SetOutputOptions(SpssClient.DocExportOption.ExcelOperationOptions,

                            "CreateWorkbook")

OutputDoc.SetOutputOptions(SpssClient.DocExportOption.ExcelSheetNames,

                            "Utilization")

OutputItems = OutputDoc.GetOutputItems()

for index in range(OutputItems.Size()):

    OutputItem = OutputItems.GetItemAt(index)

    if (OutputItem.GetType() == SpssClient.OutputItemType.HEAD and

        OutputItem.GetDescription() == "Utilization"):

            OutputItem.SetSelected(True)

try:

    OutputDoc.ExportDocument(SpssClient.SpssExportSubset.SpssSelected,

                            "outfile",

                            SpssClient.DocExportFormat.SpssFormatXls)

except:

    print sys.exc_info()[1]

OutputDoc.ClearSelection()

SpssClient.StopClient()

 

 

Matthew Pirritano, Ph.D.

Research Analyst IV

Medical Services Initiative (MSI)

Orange County Health Care Agency

(714) 568-5648

 « Return to Thread: ODBC Query that returns a file?