Skip to main content

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


Download files

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

Source Distribution

streamlit_luckysheet-0.0.9.tar.gz (6.1 MB view details)

Uploaded Source

Built Distribution

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

streamlit_luckysheet-0.0.9-py3-none-any.whl (14.7 MB view details)

Uploaded Python 3

File details

Details for the file streamlit_luckysheet-0.0.9.tar.gz.

File metadata

  • Download URL: streamlit_luckysheet-0.0.9.tar.gz
  • Upload date:
  • Size: 6.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for streamlit_luckysheet-0.0.9.tar.gz
Algorithm Hash digest
SHA256 243a867b5f216851a5a7f2faf882a16784825cdc209d48d2054eda10d997ced0
MD5 a79d78a916d16196490d981cc5d9e404
BLAKE2b-256 9606b428cd52299a8cc23666761c2406cb83a253a79b35345ad0099ab6d0f96d

See more details on using hashes here.

File details

Details for the file streamlit_luckysheet-0.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_luckysheet-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 4c14d0bcaebf1cfa3c69d9ccf1a65a3121f06d3953539a6c9ab54c0f7d6fdc20
MD5 2dfcf9ff293c35547094eba5707fb8ed
BLAKE2b-256 17456f42e660c4bcba45021c0ab9c78866e2beeaf53c6e6c058720a13a467140

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