Read and write xlsx/xlst using pandas/openpyxl while preserving Excel formatting
Project description
xlPandas
Read and write Excel xlsx using pandas/openpyxl without destroying formatting.
Sometimes you have a nicely formatted worksheet, but you'd like to work with it using pandas, or perhaps you want to write data to an Excel template.
Pandas can read and write Excel files using xlrd
, but treats them like csvs.
xlPandas uses openpyxl to access data
while preserving template formatting, macros, and other worksheet attributes.
Install
pip install xlpandas
Example
import xlpandas as xpd
# Read excel file
df = xpd.read_file('template.xlsx', skiprows=2)
print(df.columns)
# Modify dataframe
df['new_column'] = True
# Access openpyxl worksheet
sheet = df.to_sheet()
sheet.cell(1,1).value = 'title'
# From openpyxl worksheet
df = xpd.xlDataFrame(sheet)
# Write file
df.to_file('out.xlsx')
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
xlpandas-0.1.4.tar.gz
(3.0 kB
view details)
Built Distribution
File details
Details for the file xlpandas-0.1.4.tar.gz
.
File metadata
- Download URL: xlpandas-0.1.4.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e047d99c119f3896720a925e0464e1521925bccf7cb9ba68448e63cb74a1e5c0 |
|
MD5 | 254fecc1889a2252bd056d785d349951 |
|
BLAKE2b-256 | 831fdae3a1bcd8b7fe2c7e36c22b3d4331ce0e45b4ea3f95965189baed2d64b3 |
File details
Details for the file xlpandas-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: xlpandas-0.1.4-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d27c6d475feca524bef2634183f3ccea2d00c34fca2dd75aec1f04512f7d51b5 |
|
MD5 | b3b2099977f050421e7c898772dcf30e |
|
BLAKE2b-256 | f2e19dadc1e85af6c664eb4d96b037f9e4cd519424dd454cfcb6a961c2d94448 |