Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Example XlsxWriter in Python

##############################################################################
#
# A simple example of some of the features of the XlsxWriter Python module.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright 2013-2021, John McNamara, jmcnamara@cpan.org
#
import xlsxwriter


# Create an new Excel file and add a worksheet.
workbook = xlsxwriter.Workbook('demo.xlsx')
worksheet = workbook.add_worksheet()

# Widen the first column to make the text clearer.
worksheet.set_column('A:A', 20)

# Add a bold format to use to highlight cells.
bold = workbook.add_format({'bold': True})

# Write some simple text.
worksheet.write('A1', 'Hello')

# Text with formatting.
worksheet.write('A2', 'World', bold)

# Write some numbers, with row/column notation.
worksheet.write(2, 0, 123)
worksheet.write(3, 0, 123.456)

# Insert an image.
worksheet.insert_image('B5', 'logo.png')

workbook.close()
Comment

PREVIOUS NEXT
Code Example
Python :: scientific notation matplotlib python 
Python :: run python file in interactive mode 
Python :: python relative path 
Python :: python csv reader 
Python :: python ceil 
Python :: os listdir sort by date 
Python :: python current working directory 
Python :: check if float is integer python 
Python :: how shorten with enter long script python 
Python :: create 2d list dictionary 
Python :: get a list of ids from queryset django 
Python :: read a large dataframe in pandas 
Python :: plt.plot figure size 
Python :: How to Convert Strings to Datetime in Pandas DataFrame 
Python :: python live video streaming flask 
Python :: display video in jupyter notebook 
Python :: using while loop in python taking input until it matches the desired answer 
Python :: tensorfow list devices 
Python :: import matplotlib 
Python :: mad libs in python 
Python :: weekday pandas 
Python :: groupby year datetime pandas 
Python :: python get duration of wav file 
Python :: error urllib request no attribute 
Python :: generate sha1 python 
Python :: making a function wait in python 
Python :: dataframe get row by name 
Python :: python import multiple csv 
Python :: import image 
Python :: set pixel pygame 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =