I am using QGIS version 2.18.19. I have written a standalone script which converts a DXF file in to polygon shapefile. Now I want to write data into the attribute table of the polygon shapefile from a Excel file which I used as a input to the script.
My code is as follows:
dxf_to_polygon=name
t=table
dxffile=file
fpoly=output vector
outputs_GRASS7V_IN_DXF_1=processing.runalg('grass7:v.in.dxf', dxffile,'1',True,False,True,False,False,True,'200000.000000,700000.000000,200000.000000,700000.000000',0,None)
outputs_GRASS7V_CLEAN_1=processing.runalg('grass7:v.clean', outputs_GRASS7V_IN_DXF_1['output'],1,0.1,'200000.000000,700000.000000,200000.000000,700000.000000',-1.0,0.0001,None,None)
outputs_QGISPOLYGONIZE_1=processing.runalg('qgis:polygonize', outputs_GRASS7V_CLEAN_1['output'],True,True,None)
outputs_SAGAPOLYGONDISSOLVEBYATTRIBUTE_1=processing.runalg('saga:polygondissolvebyattribute', outputs_QGISPOLYGONIZE_1['OUTPUT'],'area','layer','perimeter',False,None)
outputs_SAGAPOLYGONDISSOLVEALLPOLYGONS_1=processing.runalg('saga:polygondissolveallpolygons', outputs_SAGAPOLYGONDISSOLVEBYATTRIBUTE_1['DISSOLVED'],False,None)
outputs_QGISADDFIELDTOATTRIBUTESTABLE_1=processing.runalg('qgis:addfieldtoattributestable', outputs_SAGAPOLYGONDISSOLVEALLPOLYGONS_1['DISSOLVED'],'Req_No',2,30.0,0.0,None)
outputs_QGISADDFIELDTOATTRIBUTESTABLE_2=processing.runalg('qgis:addfieldtoattributestable', outputs_QGISADDFIELDTOATTRIBUTESTABLE_1['OUTPUT_LAYER'],'Surveyor_Name',2,25.0,0.0,None)
outputs_QGISADDFIELDTOATTRIBUTESTABLE_3=processing.runalg('qgis:addfieldtoattributestable', outputs_QGISADDFIELDTOATTRIBUTESTABLE_2['OUTPUT_LAYER'],'Survey_Date',2,20.0,0.0,None)
outputs_QGISADDFIELDTOATTRIBUTESTABLE_4=processing.runalg('qgis:addfieldtoattributestable', outputs_QGISADDFIELDTOATTRIBUTESTABLE_3['OUTPUT_LAYER'],'Plan_Name',2,20.0,0.0,fpoly)
How can I solve this?
Join attributes table
which should let you join the table of the final output with the excel input.