You might be in a situation where you want to display an Excel file on a web page in your blog post. Another case could be where you want to show an invoice to your users in a PDF format. Google comes to rescue you in such situations by offering an online viewer, which can also be easily embedded to view popular file formats in your browser.

With the Google Document Preview widget, you can make use of the service and embed the files to preview on your web page.

For example, using this Dummy PDF URL (https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf) will display the below preview.

  • URL: File URL to be displayed in the Preview. It can also be dynamic.

  • Height: Set a height in percentage, pixels, or viewport height.

Supported file types

Google Docs Viewer supports different file types, listed below:

  • Image files (.GIF, .TIFF, .BMP)

  • Raw Image formats

  • Video files (WebM, .MPEG4, .3GPP, .MOV, .AVI, .MPEGPS, .WMV, .FLV, .ogg)

  • Microsoft Word (.DOC and .DOCX)

  • Microsoft Excel (.XLS and .XLSX)

  • Microsoft PowerPoint (.PPT and .PPTX)

  • Adobe Portable Document Format (.PDF)

  • Tagged Image File Format (.TIFF)

  • Scalable Vector Graphics (.SVG)

  • PostScript (.EPS, .PS)

  • TrueType (.TTF)

  • XML Paper Specification (.XPS)

  • .MTS files

  • Google Docs

  • Google Sheets

  • Google Slides

  • Google Forms

  • Google Drawings

Did this answer your question?