Add PDF export support for Google Sheets
Co-authored-by: taylorwilsdon <6508528+taylorwilsdon@users.noreply.github.com>
This commit is contained in:
@@ -225,7 +225,7 @@ async def get_drive_file_download_url(
|
|||||||
|
|
||||||
For Google native files (Docs, Sheets, Slides), exports to a useful format:
|
For Google native files (Docs, Sheets, Slides), exports to a useful format:
|
||||||
• Google Docs → PDF (default) or DOCX if export_format='docx'
|
• Google Docs → PDF (default) or DOCX if export_format='docx'
|
||||||
• Google Sheets → XLSX (default) or CSV if export_format='csv'
|
• Google Sheets → XLSX (default), PDF if export_format='pdf', or CSV if export_format='csv'
|
||||||
• Google Slides → PDF (default) or PPTX if export_format='pptx'
|
• Google Slides → PDF (default) or PPTX if export_format='pptx'
|
||||||
|
|
||||||
For other files, downloads the original file format.
|
For other files, downloads the original file format.
|
||||||
@@ -280,6 +280,11 @@ async def get_drive_file_download_url(
|
|||||||
output_mime_type = export_mime_type
|
output_mime_type = export_mime_type
|
||||||
if not output_filename.endswith(".csv"):
|
if not output_filename.endswith(".csv"):
|
||||||
output_filename = f"{Path(output_filename).stem}.csv"
|
output_filename = f"{Path(output_filename).stem}.csv"
|
||||||
|
elif export_format == "pdf":
|
||||||
|
export_mime_type = "application/pdf"
|
||||||
|
output_mime_type = export_mime_type
|
||||||
|
if not output_filename.endswith(".pdf"):
|
||||||
|
output_filename = f"{Path(output_filename).stem}.pdf"
|
||||||
else:
|
else:
|
||||||
# Default to XLSX
|
# Default to XLSX
|
||||||
export_mime_type = (
|
export_mime_type = (
|
||||||
|
|||||||
Reference in New Issue
Block a user