Questions tagged [xlsxwriter]

XlsxWriter is a python module for creating Excel XLSX files

XlsxWriter is a Python module for creating Excel XLSX files.

It can be used to write text, numbers, and formulas to multiple worksheets and it supports features such as formatting, images, charts, page setup, autofilters, conditional formatting and many others.

This module cannot be used to modify or write to an existing Excel XLSX file.

1959 questions
165
votes
14 answers

How to save a new sheet in an existing excel file, using Pandas?

I want to use excel files to store data elaborated with python. My problem is that I can't add sheets to an existing excel file. Here I suggest a sample code to work with in order to reach this issue import pandas as pd import numpy as np path =…
Stefano Fedele
  • 6,877
  • 9
  • 29
  • 48
95
votes
6 answers

Putting many python pandas dataframes to one excel worksheet

It is quite easy to add many pandas dataframes into excel work book as long as it is different worksheets. But, it is somewhat tricky to get many dataframes into one worksheet if you want to use pandas built-in df.to_excel functionality. # Creating…
nyan314sn
  • 1,766
  • 3
  • 17
  • 29
73
votes
11 answers

Simulate autofit column in xslxwriter

I would like to simulate the Excel autofit function in Python's xlsxwriter. According to this url, it is not directly supported: http://xlsxwriter.readthedocs.io/worksheet.html However, it should be quite straightforward to loop through each cell…
Be Kind To New Users
  • 9,672
  • 13
  • 78
  • 125
46
votes
10 answers

ImportError: No module named xlsxwriter

I recently downloaded the xlsxwriter version 0.6.4 and installed it on my computer. It correctly added it to my C:\Python27\Lib\site-packages\xlsxwriter folder, however when I try to import it I get the error ImportError: No module named…
pwned555
  • 624
  • 1
  • 5
  • 8
46
votes
4 answers

xlsxwriter: is there a way to open an existing worksheet in my workbook?

I'm able to open my pre-existing workbook, but I don't see any way to open pre-existing worksheets within that workbook. Is there any way to do this?
Nick
  • 485
  • 1
  • 4
  • 3
44
votes
6 answers

XlsxWriter object save as http response to create download in Django

XlsxWriter object save as http response to create download in Django?
Waheed
  • 645
  • 1
  • 6
  • 9
41
votes
4 answers

Apply format to a cell after being written in XlsxWriter

I work on python using XlsxWriter and I've been trying to solve this problem with no success: My app must create an Xlsx file in which data is shown in a table-like structure. That table has some empty cells. I'd like to set borders to some cells to…
vbarb
  • 413
  • 1
  • 4
  • 4
40
votes
7 answers

pandas xlsxwriter, format table header - not sheet header

I'm saving pandas DataFrame to_excel using xlsxwriter. I've managed to format all of my data (set column width, font size etc) except for changing header's font and I can't find the way to do it. Here's my example: import pandas as pd data =…
Egor Ignatenkov
  • 1,242
  • 2
  • 12
  • 29
40
votes
4 answers

Adjust cell width in Excel

I am using xlsxwriter to write into Excel sheet. I am facing issue: when text is more then cell size it's getting hidden. import xlsxwriter workbook = xlsxwriter.Workbook("file.xlsx") worksheet1 = workbook.add_worksheet() worksheet1.write(1,…
Ravichandra
  • 2,162
  • 4
  • 24
  • 36
37
votes
3 answers

How to save in *.xlsx long URL in cell using Pandas

For example I read excel file into DataFrame with 2 columns(id and URL). URLs in input file are like text(without hyperlinks): input_f = pd.read_excel("input.xlsx") Watch what inside this DataFrame - everything was successfully read, all URLs are…
chinskiy
  • 2,557
  • 4
  • 21
  • 40
34
votes
4 answers

How to write/update data into cells of existing XLSX workbook using xlsxwriter in python

I am able to write into new xlsx workbook using import xlsxwriter def write_column(csvlist): workbook = xlsxwriter.Workbook("filename.xlsx",{'strings_to_numbers': True}) worksheet = workbook.add_worksheet() row = 0 col = 0 for…
user2787436
  • 359
  • 1
  • 3
  • 5
33
votes
12 answers

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

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…
Gustavo Rottgering
  • 511
  • 1
  • 4
  • 11
31
votes
1 answer

Using Python, write an Excel file with columns copied from another Excel file

I have an Excel file containing a varying number of columns, I would like to loop through certain columns (from their header row value) of that file using Python, then write (copy) those columns to another Excel file. Any examples on how I can do…
salamey
  • 3,633
  • 10
  • 38
  • 71
23
votes
4 answers

Write to StringIO object using Pandas Excelwriter?

I can pass a StringIO object to pd.to_csv() just fine: io = StringIO.StringIO() pd.DataFrame().to_csv(io) But when using the excel writer, I am having a lot more trouble. io = StringIO.StringIO() writer =…
A User
  • 812
  • 2
  • 7
  • 21
20
votes
1 answer

python xlsxwriter change row height for all rows in the sheet

Python xlsxwriter, change row height for all rows in the sheet, following is available but apply to single row worksheet.set_row(0, 20) # Set the height of Row 1 to 20. Want to change height of all the rows sheet.
Snehal Parmar
  • 5,453
  • 3
  • 35
  • 46
1
2 3
99 100