I am trying to ungroup the data in excel file.
I am not aware of row no which have been grouped.
When I click on 2 on top of file data gets ungrouped.
Is there a way I could do it using python.
I have set of 400-500 file for which data has to be ungrouped
I tried using win32com library
xl = win32com.client.Dispatch("Excel.Application")
# password, act accordingly
#xl.Visible = True # Optional: Hide Excel application window
wb = xl.Workbooks.Open(excel_file)
try:
for sheet in wb.Worksheets:
sheet_name = sheet.Name
sheet.PageSetup.Zoom = False # Disable zoom
# visible_range = sheet.UsedRange.Visible
# sheet.Find(What="*", ReplaceWith="", SearchOrder=xlPrevious, SearchDirection=xlEntireRow, MatchCase=False).Select()
# sheet.Selection.Visible = visible_range # Restore original visibility
# cells = sheet.getCells()
# cells.ungroupRows(17,26)
# Ungroup rows (if grouped)
for outline in sheet.Outline:
if outline.Type == 2: # Check if it's an outline group
outline.Ungroup()