excel

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

vbaShellRun for Python

vbaShellRun for Python Question: I am running a macro from Excel that calls a python script. I have Python 3.11.5 installed in one location on my PC and 3.12.1 installed at another. When I call the script using 3.11.5 vbaShell.Run """C:Python311python.exe""" & " " & """D:UsersadminDesktopProjectspythongetDataTests.py""" & " " & """" & Workbook & """" …

Total answers: 2

trying to add sparklines to multiple rows with xlsxwriter

trying to add sparklines to multiple rows with xlsxwriter Question: Im trying to add sparklines into a column with xlsxwriter to my excel. I got it to work with just one row but i wanted to ask how i would do this for multiple rows without writing out multiple lines of code for each row. …

Total answers: 1

How to represent the data of an excel file into a directed graph? Python

How to represent the data of an excel file into a directed graph? Python Question: I have downloaded California road network dataset from Stanford Network Analysis Project. The data is a text file which can be converted to an excel file with two columns. The first is for the start nodes, and the second column …

Total answers: 2

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

file module issues with excel format

File module issues with excel format Question: My goal is to write result into single excel file, here is simple code that I tried: import numpy_financial as npf Present = 2000 period = 20 rate = 0.12 pmt = abs(npf.pmt(rate/12,period*12,Present)) print(pmt) import csv file = open("Result.xlsx",’w’) file = csv.writer(file) file.writerow([pmt]) As an outcome, Result.xlsx was …

Total answers: 1

Export styled dataframe to Excel (background color)

Export styled dataframe to Excel (background color) Question: I’m looking to generate an excel file from styled dataframes. Specifically I want to keep the background colors of cells. I can generate an excel file with df.to_excel() or df.style.to_excel(), but the background color disappears along the way. Is there any way to keep the background color? …

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