AnsweredAssumed Answered

python for Pro: how to set File Path parameter

Question asked by helenchu on Aug 21, 2020
Latest reply on Aug 21, 2020 by helenchu


My python codes were generated from ModelBuilder.  At the process of "Table To Excel"  I need to have 2 parameters: File_Path and File_Name.  So in "Properties" of Script, I add those 2 parameters but the parameter for File Path doesn't work. No error but file was saved to the "Scratch" folder.  What step that I missed?  Thanks for your help.



# Model Environment settings
with arcpy.EnvManager(scratchWorkspace=r"C:\ModelBuilder\Scratch\Output.gdb", workspace=r"C:\ModelBuilder\Scratch\Output.gdb"):
Output_gdb = "C:\\ModelBuilder\\Scratch\\Output.gdb"

# Process: Table To Excel (Table To Excel) (conversion)
arcpy.conversion.TableToExcel(Input_Table=Parcels_Lots_DeleteIdentical, Output_Excel_File=ExcelFileName_xls, Use_field_alias_as_column_header="ALIAS", Use_domain_and_subtype_description="DESCRIPTION")
if __name__ == '__main__':