20 lines
361 B
Python
20 lines
361 B
Python
import subprocess
|
|
import os
|
|
|
|
def excel_to_pdf(excel_path, output_dir):
|
|
os.makedirs(output_dir, exist_ok=True)
|
|
|
|
subprocess.run(
|
|
[
|
|
"soffice",
|
|
"--headless",
|
|
"--convert-to", "pdf",
|
|
excel_path,
|
|
"--outdir", output_dir
|
|
],
|
|
check=True
|
|
)
|
|
|
|
excel_to_pdf("test.xlsx", "./pdf")
|
|
|