docs.sheetjs.com/docz/static/pandas/SheetJSPandas.py
2024-01-30 04:27:22 -05:00

26 lines
571 B
Python

#!/usr/bin/env python3
from sheetjs import SheetJSWrapper
def process(path):
with SheetJSWrapper() as sheetjs:
# Parse file
wb = sheetjs.read_file(path)
print(f"Loaded file {path}")
# Get first worksheet name
names = wb.get_sheet_names()
print(f"Reading from sheet {names[0]}")
# Generate DataFrame from first worksheet
df = wb.get_df()
print(df.info())
# Export DataFrame to XLSB
sheetjs.write_df(df, "SheetJSPandas.xlsb", sheet_name="DataFrame")
if("__main__" == __name__):
from sys import argv
process(argv[1])