AnsweredAssumed Answered

Get workspace from mxd

Question asked by sonj on Nov 27, 2013
Latest reply on Nov 29, 2013 by sonj
Hi All,

I have written script to update data from excel to pgdb for ArcGIS 10 and it is working fine. We have upgraded to 10.1 recently and the script is not working. The ListWorkspaces() give the excel path as well as current workspace pgdb path but in 10.1 it is not written.

import os import arcpy import xlrd  arcpy.env.overwriteOutput = True  inWS = r'C:\SampleData\XXXX\Excels' arcpy.env.workspace = inWS mxd = arcpy.mapping.MapDocument("Current")  workspaces = arcpy.ListWorkspaces() for ws in workspaces:     arcpy.AddMessage(ws)   del mxd, workspaces


The FeatureClasses get from arcpy.mapping.ListLayers(mxd) but to open table the below code is using and update the attributes.

arcpy.env.workspace = ws tableList = arcpy.ListTables()


Please guide me how to get workspace, tablelist by using mxd in ArcGIS 10.1

Regards
Johnson

Outcomes