Create excel file, Insert image, Draw Bar Graphs in excel files in python using xlsxwriter

Write Data to excel file:

import xlsxwriter# Create an new Excel file and add a worksheet.workbook = xlsxwriter.Workbook('test.xlsx')
worksheet = workbook.add_worksheet() # Sheet1
worksheet = workbook.add_worksheet(‘WorkLog’) # WorkLog
worksheet.write(0, 0, ‘MicroPyramid’)
worksheet.write(‘A1’, ‘MicroPyramid’)

Insert Image to Excel File:

worksheet.insert_image('B5', 'logo.png')
worksheet.insert_image(2, 4', 'logo.png')

Draw Charts in the excel Sheet:

chart = workbook.add_chart({'type': 'column'})
# Write some data to add to plot on the chart.
data = [
[5, 10, 15, 20, 25],
]
worksheet.write_column('A1', data[0])
# Configure the charts. In simplest case we just add some data series.
chart.add_series({'values': '=Sheet1!$A$1:$A$5'})
# Insert the chart into the worksheet.
worksheet.insert_chart('A7', chart)
workbook.close()

The article was originally published at MicroPyramid blog

--

--

--

Python, Django, Android and IOS, reactjs, react-native, AWS, Salesforce consulting & development company

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Pair Programming

Hadoop: The unavoidable Big Data Tool

Introducing Front Cache of ARCUS Spring

Release Notes: Codenvy 5.4

Auto Deploy Your Client and Server From Separate Repos Under Single Heroko App

Automatically create a branch from an issue in GitHub

Although I am not a programmer, after i read this article, I can understand a little.

TWiGCP — “G Suite (for developers), Recommendations AI, and proxyless services”

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
MicroPyramid

MicroPyramid

Python, Django, Android and IOS, reactjs, react-native, AWS, Salesforce consulting & development company

More from Medium

Inserting into database using Python and SQLite

Convert CSV(s) to a SQLite database

Python Project — Predicting Insurance Premiums

Python Flask Tutorial: Build Your Flask Application