openpyxl

Change the Chart Style from a Line Chart in Excel with Openpyxl

Change the Chart Style from a Line Chart in Excel with Openpyxl Question: I have this following code to export a set of dataframes and then convert them to tables in excel and applying a color format, then it creates Line Graphs for every table, everything works but I’m having trouble with the following: Apply …

Total answers: 1

Using Geopy to place (tkintermapview) Markers on Addresses that are pulled from a Spreadsheet

Using Geopy to place (tkintermapview) Markers on Addresses that are pulled from a Spreadsheet Question: I am attempting to get Addresses from a Spreadsheet.. Convert those Addresses to Latitude and Longitude.. Then Add Markers to those Coordinates on a TkinterMapView Map. I used openpyxl to make a Workbook: wB = load_workbook(‘HoldingCats(1).xlsx’) wS = wB.active column_b …

Total answers: 1

Writing only part of the text in a cell as bold?

Writing only part of the text in a cell as bold? Question: i am writing / changing a cell-value in an existing excel-sheet using openpyxl and formating the cell as bold using the following code: import openpyxl from openpyxl.styles import Font workbook = openpyxl.load_workbook("try.xlsx") worksheet = workbook.active worksheet[‘C1’] = "this is some text is use" …

Total answers: 1

ExcelWriter using openpyxl engine ignoring date_format parameter

ExcelWriter using openpyxl engine ignoring date_format parameter Question: I have read quite a few answers on this, but when I run my code I don’t get the same result. I am using pandas 2.0.0 and openpyxl 3.1.2 on Python 3.9 This is a reduced example of my issue, which is that I can’t get the …

Total answers: 2

Error: AttributeError: 'str' object has no attribute 'row'

Error: AttributeError: 'str' object has no attribute 'row' Question: I have code: def add_to_database(object_name, value): workbook = openpyxl.load_workbook(DATABASE_FILE) worksheet = workbook[DATABASE_SHEET] object_row = None for row in worksheet.iter_rows(min_row = 1, max_row = worksheet.max_row + 1, values_only = True): if row[0] == object_name: object_row = row break if object_row: worksheet.cell(row = object_row[0].row, column = 2).value += …

Total answers: 1

Openpyxl: Excel file created is not showing validation errors or prompt message

Openpyxl: Excel file created is not showing validation errors or prompt message Question: I am generating a excel file using openpyxl and adding a list as a validation. I am successfully able to create the drop down list but when I add invalid data in the validated column it shows no error or prompt even …

Total answers: 1

python write a list to multiple columns in excel

python write a list to multiple columns in excel Question: I am trying to write many columns in excel. I have a list let’s say as below list1=[1,2,3,4,5] the other list will be like list2=[‘a’,’b’,’c’] I will have many different sized(length) lists which is why I cannot create dataframe in pandas and write it. list3=[‘1a’,’2b’,’3c’,’4d’] …

Total answers: 1

Xlsm file Python

Xlsm file Python Question: I want to open an .xlsm file with openpyxl library. When I tried to open it, it gives me the IndexError: index out of range. I also observed if I delete all the hidden worksheets in the file before running the code it will be OK. Can you help me? Because …

Total answers: 2

reading multi-index header based excel file using pandas

reading multi-index header based excel file using pandas Question: I have an excel file where first 3 rows have header names, I want to read it in pandas but facing difficulty in the multi-index header. PLAN 2023 Traffic per channel Traffic Share per Channel month week All Traffic red green orange red green orange jan …

Total answers: 1

Whole column background formatted the same manner with openpyxl doesn't work as intended

Whole column background formatted the same manner with openpyxl doesn't work as intended Question: MRE: import openpyxl from openpyxl.styles import PatternFill # Create a new workbook workbook = openpyxl.Workbook() # Select the active sheet sheet = workbook.active # Set the background color of the third column to black fill = PatternFill(start_color=’000000′, end_color=’000000′, fill_type=’solid’) for cell …

Total answers: 1