Sign up (with export icon)

Pasting content from Google Docs

Contribute to this guide Show the table of contents

The paste from Google Docs feature lets you paste content from Google Docs and preserve its original structure and formatting.

Note

The Paste from Office plugin only preserves content formatting and structures that are included in your CKEditor 5 setup. This means that you may need to add missing features such as font color or text alignment. Read more in the Automatic content filtering section below.

Demo

Copy link

To test pasting from Google Docs, open the sample Google Docs document. Then copy its content and paste it into the editor below.

Additional feature information

Copy link

Thanks to the paste from Google Docs feature, you can copy and paste a Google Docs document into CKEditor 5 and maintain basic text styling, heading levels, links, lists, tables, and images.

When the plugin is enabled, it automatically detects Google Docs content and transforms its structure and formatting to clean HTML which is then transformed into semantic content by the editor.

The PasteFromOffice plugin also allows you to paste content from Microsoft Word. See the pasting content from Microsoft Office guide to learn more.

Automatic content filtering

Copy link

With CKEditor 5 you do not need to worry about pasting messy content from Google Docs (or any other possible sources). Thanks to the CKEditor 5 custom data model, only content that is specifically handled by the loaded rich-text editor features will be preserved.

This means that if you did not enable, for instance, font family and font size features, this sort of formatting will be automatically stripped off when you paste content from Google Docs and other sources (like other websites).

Installation

Copy link

After installing the editor, add the feature to your plugin list and toolbar configuration:

import { ClassicEditor, PasteFromOffice } from 'ckeditor5';

ClassicEditor
	.create( document.querySelector( '#editor' ), {
		licenseKey: '<YOUR_LICENSE_KEY>', // Or 'GPL'.
		plugins: [ PasteFromOffice, /* ... */ ]
	} )
	.then( /* ... */ )
	.catch( /* ... */ );
Copy code

Support for other applications

Copy link

At the current stage, the focus of the @ckeditor/ckeditor5-paste-from-office package is on supporting content that comes from Microsoft Word and Google Docs. However, it does not mean that pasting from other similar applications (such as Microsoft Excel) is not supported.

By default, CKEditor 5 will support pasting rich-text content from these applications, however, some styles and formatting may be lost, depending on the source application. Also, other minor bugs may appear.

You can find more information regarding compatibility with other applications in this ticket.

If you think that support for any of the applications needs improvements, add 👍 and comments in the following issues:

Feel free to open a new feature request for other similar applications, too!

Copy link

CKEditor 5 supports a wider range of paste features, including:

  • Paste plain text – Paste text without formatting that will inherit the style of the content it was pasted into.
  • Paste from Office – Paste content from Microsoft Word and keep the original structure and formatting.
  • Enhanced paste from Office – Enhanced paste from Office is a premium version of the plugin that offers far greater capabilities.
  • Import from Word – Convert Word files directly into HTML content.
  • Paste Markdown – Paste Markdown-formatted content straight into the editor.

Contribute

Copy link

The source code of the feature is available on GitHub at https://github.com/ckeditor/ckeditor5/tree/master/packages/ckeditor5-paste-from-office.