Search code examples
google-apps-scriptgoogle-sheetsgoogle-docs-api

Display the PDF version of Google Sheets


I want to display the PDF version of google sheet. I have tried with

https://docs.google.com/viewer?url=https://docs.google.com/spreadsheets/d/1Yp55fNmcrPQ96eggHpVTEFDCSIUcxEFGnK-TTmv111o/export?format=pdf&embedded=true

The examples here are https://gist.github.com/tzmartin/1cf85dc3d975f94cfddc04bc0dd399be


Solution

  • You are using the correct syntax to display a public Spreadsheet as a pdf

    For my sample sheet as below it works:

    https://docs.google.com/viewer?url=https://docs.google.com/spreadsheets/d/1hnx_EWPN3Djs9tOIjfOt0R7XC3bsn66uLdTBxmlQAx8/export?format=pdf&embedded=true

    If it is not working for you, either

    • The document is not spreadsheet

    • The id is not correct

    • The sharing permissions are not sufficient - try to set it as Public on the web enter image description here