Skip to main content

Style and format Excel files easily with openpyxl

Project description

excelstyler

excelstyler is a Python package that makes it easy to style and format Excel worksheets using openpyxl.

Installation

pip install excelstyler

Example

from excelstyler.styles import GREEN_CELL
from excelstyler.utils import shamsi_date
from excelstyler.headers import create_header

import openpyxl

output = BytesIO()
workbook = Workbook()
worksheet = workbook.active
worksheet.sheet_view.rightToLeft = True   # if you iranian else False
worksheet.insert_rows(1)
create_header(ws, ["Name", "Score"], 1, 1, color='green')
workbook.save(output)
output.seek(0)

response = HttpResponse(
  content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
response[
  'Content-Disposition'] = f'attachment; filename="test file.xlsx"'.encode(
  'utf-8') # support from persian
response.write(output.getvalue())
return response

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

excelstyler-0.1.1.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

excelstyler-0.1.1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file excelstyler-0.1.1.tar.gz.

File metadata

  • Download URL: excelstyler-0.1.1.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.1

File hashes

Hashes for excelstyler-0.1.1.tar.gz
Algorithm Hash digest
SHA256 941f58c43a504e7b965568c396b64a212c44ef07b9af1eaff3bf93731193b9ec
MD5 89a18f0d0abd1c9798ee440baf9045ed
BLAKE2b-256 0a26fdd9f3f2d95cecb954b835fed028059d194c1142a4729fa7ab244d1321c1

See more details on using hashes here.

File details

Details for the file excelstyler-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: excelstyler-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.1

File hashes

Hashes for excelstyler-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9a9a11cfdfd9bc0a818f14295690b2dfada2043257664abc98a4ad9f71fe069a
MD5 732efbaa6f0265bf2f55f9920844d11d
BLAKE2b-256 49074bb8c1afdfa1be50a7085b148cadc1fdf77203da402f01ba8eff2b79781b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page