No project description provided
Project description
streamlit-luckysheet
2024 Aug 18 First Ever Streamlit luckysheet. Credit To TAN YIHAO
Installation instructions
pip install streamlit-luckysheet
Usage instructions
import streamlit as st
from streamlit_luckysheet import streamlit_luckysheet
import base64
import os
st.set_page_config(layout="wide")
st.subheader("Component with constant args")
name = "Streamlit_Excelsheet"
key = "Streamlit_Excelsheet"
height = 1000
excel_path = r".\excel\Employee Sample Data.xlsx"
output_path = r".\excel\testing.xlsx"
def excel_to_file(path):
try:
if not os.path.exists(path):
return ""
with open(path, 'rb') as file:
file_data = file.read()
if file_data:
return base64.b64encode(file_data).decode('utf-8')
else:
st.warning("File is empty or could not be read.")
return ""
except Exception as e:
st.warning(f"An error occurred while processing the file: {e}")
return ""
def base64_to_excel(base64_string, output_path):
try:
output_dir = os.path.dirname(output_path)
if not os.path.exists(output_dir):
os.makedirs(output_dir)
file_data = base64.b64decode(base64_string)
with open(output_path, 'wb') as file:
file.write(file_data)
st.success(f"Excel file successfully created at: {output_path}")
except Exception as e:
st.warning(f"An error occurred while converting to Excel file: {e}")
encodedFile = excel_to_file(excel_path)
return_result = streamlit_luckysheet(name=name, height=height, encodedFile=encodedFile, key=key, default=[])
if isinstance(return_result, dict) and "incoming_save" in return_result:
if return_result["incoming_save"]:
base64_string = return_result["incoming_save"]
base64_to_excel(base64_string, output_path)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file streamlit_luckysheet-0.0.6.tar.gz.
File metadata
- Download URL: streamlit_luckysheet-0.0.6.tar.gz
- Upload date:
- Size: 6.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd148f1b3a3e4c79a222259e1cdef86eacc60042cf548d152a8d39f3f1828fb8
|
|
| MD5 |
5b0744f59d4e570c9d0f91d1f73df93c
|
|
| BLAKE2b-256 |
4a09763e3d394e73a1f07fd2fe1b49ddefd0a8c18a61cce22f1ca0facd68b1f2
|
File details
Details for the file streamlit_luckysheet-0.0.6-py3-none-any.whl.
File metadata
- Download URL: streamlit_luckysheet-0.0.6-py3-none-any.whl
- Upload date:
- Size: 10.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3817ba7abff528f5d803d07eb732cd0bea7bbaa06eab88deb4ecd63aa1d4682b
|
|
| MD5 |
f35700e6f111964c7ed9f38fbb6323f5
|
|
| BLAKE2b-256 |
87636b99c54ef489b3609fd7a1a4d7691b06913ae3f89766784c7c3e13ded0b5
|