Skip to main content
4 of 10
added 466 characters in body

Query the fields of an attribute table of a .shp file (ArcMap) from an .xlsm file with Python

What I want to do is query the fields of a .shp file from an excel .xlsm file, that is, avoid the repetitive and manual process of copying the attribute table from arcmap to the working .xlsm file,

For example, query and write the values ​​of this attribute table displayed in arcmap and contained in the VHDissolve.shp file from my Excel VINCULACION.xlsm file

enter image description here enter image description here

Note: The attribute table and the table in excel have the same fields.

This is a good start apparently

# Set local variables

inTable = outTable

outXLS = VHFolder + "/Vinculacion_S.xlsx" #this is where I had to give the file path and then the file name

# Execute TableToExcel

arcpy.TableToExcel_conversion(inTable, outXLS)

ersion(inTable, outXLS)

Annex link with the .shp and .xlsm files https://drive.google.com/file/d/1gEjn7Xjm0q9nCyNIJ22aLp8PE3OcVBix/view?usp=sharing