Is it possible to get the attribute values from selected features and export them to an excel file using python? If so, how do i go about it.
If I understand you correctly, you're wanting to create a selection, and then export the results to .xls.
Here's how I would do it:
# Import libaryimport arcpyfrom arcpy import env
# Set variablesyourworkspace = "path to your workspace"yourfeatureclass = "path to your feature class"outputlocation = "path to your output folder"
arcpy.env.workspace = yourworkspace
# Make Layerarcpy.MakeFeatureLayer_management (yourfeatureclass, "featureclasslayer")
# Create selectionarcpy.SelectLayerByAttribute_management ("featureclasslayer", "NEW_SELECTION" ["build your selection criteria here"])
# Copy the results of your selection to a new feature classarcpy.CopyFeatures_management ("featureclasslayer", "yourselectedfeatures")
# Export to ExcelTableToExcel_conversion ("yourselectedfeatures", "yourexcefilename.xls")
You bet. Please let me know if you have any questions and I'll do my best to help.
Retrieving data ...