@@ -169,19 +169,18 @@ def output_to_excel(data, output_folder):
169169 # Save the workbook
170170 wb .save (f'{ output_folder } /output.xlsx' )
171171
172+ def get_visio_shape_name (resource_type ):
173+ """Convert Azure resource type to a clean stencil shape name"""
174+ # Remove Microsoft. prefix and replace / with _
175+ shape_name = resource_type .replace ('Microsoft.' , '' ).replace ('/' , '_' )
176+ # Convert to lowercase for consistency
177+ return shape_name .lower ()
178+
172179def create_all_resources_sheet (wb : Workbook , resource_types ):
173- # Create All Resources sheet
174180 all_resources = wb .create_sheet (title = 'All Resources' )
175-
176- # Add index link at top
177- all_resources .insert_rows (0 )
178- cell = all_resources .cell (row = 1 , column = 1 )
179- cell .value = "Index"
180- cell .hyperlink = "#Index!A1"
181- cell .font = Font (color = Color ('0563C1' ), underline = 'single' )
182-
183- # Define only the columns we want
184- final_columns = ['subscription_id' , 'resource_group' , 'type' , 'id' , 'name' ]
181+
182+ # Define columns including the VisioShape column
183+ final_columns = ['subscription_id' , 'resource_group' , 'type' , 'id' , 'name' , 'VisioShape' ]
185184
186185 # Write header
187186 all_resources .append (final_columns )
@@ -190,12 +189,15 @@ def create_all_resources_sheet(wb: Workbook, resource_types):
190189 for sheet_name in wb .sheetnames :
191190 if sheet_name not in ['Index' , 'All Resources' , 'Recommendations' ]:
192191 sheet = wb [sheet_name ]
193- headers = [cell .value for cell in sheet [2 ]] # Get headers from row 2 (after Index link)
192+ headers = [cell .value for cell in sheet [2 ]]
194193
195- # Copy each row
196- for row in sheet .iter_rows (min_row = 3 ): # Start after headers
194+ for row in sheet .iter_rows (min_row = 3 ):
197195 row_data = {headers [i ]: cell .value for i , cell in enumerate (row )}
198- new_row = [row_data .get (col , '' ) for col in final_columns ]
196+ # Get the base data
197+ new_row = [row_data .get (col , '' ) for col in final_columns [:- 1 ]]
198+ # Add the Visio shape name
199+ visio_shape = get_visio_shape_name (row_data .get ('type' , '' ))
200+ new_row .append (visio_shape )
199201 all_resources .append (new_row )
200202
201203 # Add to index sheet
0 commit comments