Drucken Sie den gesamten Diagrammtiteltext in einer Excel-Datei mit PythonPython

Python-Programme
Guest
 Drucken Sie den gesamten Diagrammtiteltext in einer Excel-Datei mit Python

Post by Guest »

Mit Python versuche ich, den Haupttitel jedes Diagramms in einer Excel-Datei zu drucken.
Ich habe den folgenden Code ausprobiert, bekomme aber eine Fehlermeldung
AttributeError: Das Objekt „ScatterChart“ hat kein Attribut „chart_title“

Code: Select all

import openpyxl

# Load the Excel workbook
workbook = openpyxl.load_workbook(r"C:\Users\anavs\Chart\conn_Jan25.xlsx")

# Access the sheet containing the chart
sheet = workbook['charts - APAC']  # Replace with your sheet name

# Iterate through all charts in the sheet
for chart in sheet._charts:
titlec = chart.chart_title()
print(titlec)

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post