def table_to_excel(in_table, output, use_field_alias=False, use_domain_desc=False): desiredFields=["Field1","Field3","Field8"] #desired fields for excel output # Get the fields from the input fields= arcpy.ListFields(in_table) # Create a fieldinfo object fieldinfo = arcpy.FieldInfo() # Iterate through the fields and set them to fieldinfo for field in fields: if field in desiredFields: fieldinfo.addField(field.name, field.name, "VISIBLE", "") # The created crime_view layer will have fields as set in fieldinfo object arcpy.MakeTableView_management(in_table, "table_view", "", "", fieldinfo) # To persist the layer on disk make a copy of the view arcpy.TableToExcel_conversion("table_view", output)
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.