Select to view content in your preferred language

accessing excel data when publishing python script tool as gp service

2600
3
05-16-2013 09:17 AM
NadeemQazi
Regular Contributor
I have used the following testing python script it runs well on arcmap. than i used result window and published it as geoprocessing service.

however when i run it from the ARCGIS server Manager  i received following error:

Unable to complete operation.
Invalid return value: C:\arcgisserver\directories\arcgisjobs\may_exceltodbf_gpserver\jb572f53715e1473f86a7edb92a3525f8\scratch\cal.dbf


Any suggesstion.....
following is my script.

import arcpy
from arcpy import env
## Change this to your workspace location
env.workspace = "C://WEXFORD//DATA"

## Change this to your spreadsheet and workbook name
inTable = "C://WEXFORD//DATA//calculator.xlsx/sheet1$"

outLocation = ""C://WEXFORD//DATA"
outTable = "cal"
arcpy.TableToTable_conversion(inTable,outLocation,outTable)
0 Kudos
3 Replies
KevinHibma
Esri Regular Contributor
I'm not entirely sure about why you're getting that error, but can tell you that you can't use Excel tables with GP Services in 10.1.

You can use excel as a FILE (there are Python modules which read excel FILES...)
But ArcGIS Server cannot use Excel TABLES (the sheet you reference in your code with $).
You'll have to replace the excel table, or access it with other Python modules as a file.
0 Kudos
NadeemQazi
Regular Contributor
I'm not entirely sure about why you're getting that error, but can tell you that you can't use Excel tables with GP Services in 10.1.

You can use excel as a FILE (there are Python modules which read excel FILES...)
But ArcGIS Server cannot use Excel TABLES (the sheet you reference in your code with $).
You'll have to replace the excel table, or access it with other Python modules as a file.


thanks. actually i want to use the excel sheet data, so planned to convert the excel sheet in to a dbf file which worked good in arcmmap. can u please write what are other python modules to do this if i want to publish this as geoprocessing service. because i need to publish it as geoprocessing service as my client will be using it through browser.
0 Kudos
KevinHibma
Esri Regular Contributor
I'd use this http://www.arcgis.com/home/item.html?id=f3d91b8f852042e289e09a7ec8342431

We're actually putting those tools into the product at 10.2.

So you can use the Excel to Table tool to take the Excel FILE, turn it into a table that ArcGIS Server supports and continue working on it in the service.
0 Kudos