Export a pandas dataframe to an online spreadsheet
The online spreadsheet such as Google Sheets, Feishu Docs, is a good way to share data with others and is a powerful tool for data analysis and visualization. This package provides a simple way to export a pandas dataframe to a online spreadsheet.
Installation
You can install this package from PyPI using pip:
pip install dataframe-to-online-spreadsheet
Usage
Feishu Docs
- You need to register a Feishu team and get the manager_ids from Feishu Admin. Fortunately, it is free for a small team.
- You need to create an app and get the app_id and app_secret from Feishu Open Platform.
import pandas as pd
import dataframe_to_online_spreadsheet.feishu
import os
def test_feishu():
app_id = os.getenv("APP_ID")
app_secret = os.getenv("APP_SECRET")
sheet1_data = pd.read_csv("./tests/test_data1.csv")
token = sheet1_data.feishu.to_spreadsheet(app_id, app_secret, title="Daily Report", data={'title': 'sheet_name1', 'data': sheet1_data}, manager_ids=['xxx'])
sheet2_data = pd.read_csv("./tests/test_data2.csv")
token = sheet2_data.feishu.to_spreadsheet(app_id, app_secret, title="Daily Report", data={'title': 'sheet_name2', 'data': sheet2_data}, manager_ids=['xxx'], spreadsheet_token=token)
sheet3_data = pd.read_csv("./tests/test_data3.csv")
token = sheet3_data.feishu.to_spreadsheet(app_id, app_secret, title="Daily Report", data={'title': 'sheet_name3', 'data': sheet3_data}, manager_ids=['xxx'], spreadsheet_token=token)
logging.info(f"spreadsheet token: {token}")
assert token
Wecom Docs
- You need login Wecom Developer.
- You need to create an app and get the app_id and app_secret.
- Create a smartsheet and get the doc_id and sheet_id.
import pandas as pd
import dataframe_to_online_spreadsheet.wecom
import os
def test_wecom():
app_id = os.getenv("APP_ID")
app_secret = os.getenv("APP_SECRET")
doc_id = os.getenv("DOC_ID")
sheet_id = os.getenv("SHEET_ID")
sheet1_data = pd.read_csv("./tests/test_data1_wecom.csv")
fields_ids = {
"f3jXlv": "FIELD_TYPE_NUMBER",
"f8BRn6": "FIELD_TYPE_TEXT",
"fBgV4J": "FIELD_TYPE_TEXT",
"fD1c0G": "FIELD_TYPE_TEXT",
"fGJwzi": "FIELD_TYPE_TEXT",
"fMtBZy": "FIELD_TYPE_TEXT",
"fQONOH": "FIELD_TYPE_TEXT",
"fQQyQY": "FIELD_TYPE_DATE_TIME",
"fRq1I2": "FIELD_TYPE_DATE_TIME",
"fSmqgA": "FIELD_TYPE_TEXT",
"fSu8nr": "FIELD_TYPE_NUMBER",
"fWY1jO": "FIELD_TYPE_TEXT",
"fYrjfz": "FIELD_TYPE_NUMBER",
"fZH5aH": "FIELD_TYPE_TEXT",
"fZZ5uE": "FIELD_TYPE_NUMBER",
"fZilZm": "FIELD_TYPE_TEXT",
"faGRO9": "FIELD_TYPE_TEXT",
"fcIPid": "FIELD_TYPE_TEXT",
"ffPlXC": "FIELD_TYPE_NUMBER",
"fgxTYC": "FIELD_TYPE_TEXT",
"fpqHBM": "FIELD_TYPE_NUMBER",
"fwLOij": "FIELD_TYPE_TEXT",
"fxRfyy": "FIELD_TYPE_NUMBER",
"fzNsma": "FIELD_TYPE_TEXT",
"fwF1k7": "FIELD_TYPE_USER",
}
records = sheet1_data.wecom.to_spreadsheet(
app_id, app_secret, doc_id, sheet_id, fields_ids
)
logging.info(records)
assert records
Metadata
Release files for dataframe-to-online-spreadsheet 0.1.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dataframe_to_online_spreadsheet-0.1.15.tar.gz | 27.7 kB | Without provenance | Details for dataframe_to_online_spreadsheet-0.1.15.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dataframe_to_online_spreadsheet-0.1.15-py3-none-any.whl | Python 3 | none | any | Details for dataframe_to_online_spreadsheet-0.1.15-py3-none-any.whl |
Total release size: 39.6 kB
Release files / dataframe_to_online_spreadsheet-0.1.15.tar.gz
| Download URL | dataframe_to_online_spreadsheet-0.1.15.tar.gz |
|---|---|
| Size | 27.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1eafb56987f20b0c18766538fbbe0706cb07f2fe0e918bd5358bdcc85de41905
|
|
BLAKE2b-256 checksum How to use checksums |
e1e92ccead01cb62ac440f40d5427b7521bbbe27f5a76b594010a95383f5cbb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.19
|
Release files / dataframe_to_online_spreadsheet-0.1.15-py3-none-any.whl
| Download URL | dataframe_to_online_spreadsheet-0.1.15-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7a6d29d66a3c5dba992a01036dbc7dc218bdabb6f9e8fc9a88d88afcd57e59ea
|
|
BLAKE2b-256 checksum How to use checksums |
ff79b3130b811fa154caf608bac0f05c487fdbc7e511cbe4b0dd3507fa0717fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.19
|
Security for dataframe-to-online-spreadsheet 0.1.15
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.