xlsxwriter

Set_column breaks on date formats in xlsxwriter for python

Set_column breaks on date formats in xlsxwriter for python Question: I am a new python user and I am trying to understand why set_column and conditional_format work differently when I feel they should work the same. Here is an example of my code for set column. **Coloring does not work for dates** elif name == …

Total answers: 1

How to make the content written to Excel in a loop not overwritten by the previous one

How to make the content written to Excel in a loop not overwritten by the previous one Question: Extract data from multiple word tables and write them into the same sheet in Excel. path = ‘folder path’ worddocs_list = [] for filename in os.listdir(path): wordDoc = Document(path+’\’+filename) worddocs_list.append(wordDoc) writer = pd.ExcelWriter("./test.xlsx", engine=’xlsxwriter’) i = 0 …

Total answers: 1

How do I concatenate string and an integer?

How do I concatenate string and an integer? Question: act = input("Enter name of the activity") cellone = int(input("Enter the order number of activity")) cell1 = "A" + cellone worksheet.write(cell1, act) I’m trying to concatenate A and cellone but I’m getting some error saying that I can’t concatenate string and an integer, is there a …

Total answers: 4

Download an excel file with column formatting in Dash Python

Download an excel file with column formatting in Dash Python Question: I’m creating a Dash app and I want to allow users to download a pandas Dataframe as an excel file with a click on a button. I managed to implement it with this callback : @app.callback( Output("download_xlsx", "data"), Input("btn_download_xlsx", "n_clicks"), State("df", "data") ) def …

Total answers: 1

Applying formatting to multiple Excel sheets using Python and XLSXWriter

Applying formatting to multiple Excel sheets using Python and XLSXWriter Question: I have two dataframes as follows: import pandas as pd import numpy as np from datetime import date df = pd.DataFrame({‘Data’: [10, 22, 31, 43, 57, 99, 65, 74, 88], ‘Data2’:[10, 22, 31, 43, 57, 99, 65, 74, 88], ‘Data3’:[10, 22, 31, 43, 57, …

Total answers: 4

ExcelWriter ValueError: Excel does not support datetime with timezone when saving df to Excel

ExcelWriter ValueError: Excel does not support datetime with timezone when saving df to Excel Question: I’m running on this issue for quite a while now. I set the writer as follows: writer = pd.ExcelWriter(arquivo+’.xlsx’, engine = ‘xlsxwriter’, options = {‘remove_timezone’: True}) df.to_excel(writer, header = True, index = True) This code is inside s function. The …

Total answers: 11

Remove borders on indexes with Pandas + xlsxwriter

Remove borders on indexes with Pandas + xlsxwriter Question: It seems that xlsxwriter automatically adds borders around pandas df indexes. How can I remove the borders, after the data has been written? It seems when I try to use something like worksheet.set_column(‘A:A’, None, test_format) #test_format just makes borders = 0 It either removes the values, …

Total answers: 3

Merge rows based on value (pandas to excel – xlsxwriter)

Merge rows based on value (pandas to excel – xlsxwriter) Question: I’m trying to output a Pandas dataframe into an excel file using xlsxwriter. However I’m trying to apply some rule-based formatting; specifically trying to merge cells that have the same value, but having trouble coming up with how to write the loop. (New to …

Total answers: 5