Posted 21 August 2024, 2:14 pm EST - Updated 21 August 2024, 2:19 pm EST
Hello,
I have a question about a problem I’m having
When I copy a value from an outside table (google docs) and try to paste it using the toolbar functions it doesn’t work
Forums Home / Spread / SpreadJS
Posted by: pedro.moraes on 21 August 2024, 2:14 pm EST
Posted 21 August 2024, 2:14 pm EST - Updated 21 August 2024, 2:19 pm EST
Hello,
I have a question about a problem I’m having
When I copy a value from an outside table (google docs) and try to paste it using the toolbar functions it doesn’t work
Posted 22 August 2024, 12:29 am EST - Updated 22 August 2024, 12:34 am EST
Hi,
This behaviour is by design and expected. Kindly refer to the following explanation regarding the SpreadJS Clipboard Behaviour.
SpreadJS Clipboard Behaviour:
When you copy a value using the context menu or Designer Toolbar (any other option that Ctrl +C) in SpreadJS, the value is stored in SpreadJS’s internal clipboard, which is not the same as the system clipboard (the clipboard provided by the browser). Similarly, when you use the paste option in the SpreadJS context menu or Designer Toolbar (any other option than Ctrl + V) , the value is pasted from SpreadJS’s internal clipboard, not from the system clipboard. This is why, if you copy a value from Excel or Google Sheet and attempt to paste it into SpreadJS using the context menu or Designer Toolbar, it won’t work because SpreadJS’s internal clipboard does not contain that value. Conversely, when you copy a value using SpreadJS’s context menu, it is stored only in SpreadJS’s internal clipboard, making it unavailable for pasting in Excel or Google Sheets.
This behaviour is by design due to a technical limitation: the system clipboard cannot be modified by web applications unless the user explicitly grants permission or manually performs the copy action using keyboard shortcuts like Ctrl+C.
Therefore, if you copy content from Ctrl +C, from Google Sheet or Excel Online and try to paste using Ctrl + V, then it will paste successfully. However, if you try to paste using context menu or Designer Toolbar, it won’t work (in your scenario).
Google Sheets Online:
Google Sheets Online can access the system clipboard directly through an extension that Google Chrome allows, specifically the “Google Docs Offline” extension. If this extension is disabled (by navigating to chrome://extensions/), copying data from Excel and pasting it into Google Sheets using the context menu will trigger a popup asking to enable copy, cut, and paste by adding the extension. This behavior can also be observed in other browsers like Microsoft Edge and Firefox, where a similar popup will appear.
To use context menu copy/paste in Google Sheets on Chrome, the “Google Docs Offline” extension must be enabled. If it’s disabled, a popup will appear prompting you to enable the extension, and without it, the context menu copy/paste will not work as expected. This extension allows Google Sheets to bypass the limitation on modifying the system clipboard directly through browser actions.
Microsoft Office Online (Excel):
Microsoft Office Online, including Excel, accesses the system clipboard using the Clipboard API provided by modern web browsers. When you copy or cut data in Microsoft Office Online, it is stored in the system clipboard using this API. However, the Clipboard API’s functionality can vary depending on the browser and operating system. For instance, on some versions of Safari, the API may not function as intended, requiring users to rely on keyboard shortcuts for copying and pasting. Additionally, some browsers impose security restrictions on clipboard access, especially on mobile devices.
In Microsoft Edge, if you open Excel Online and use the context menu to copy and paste, you can observe API calls being made to access the system clipboard in the Developer’s Network tab. If you open Excel Online in browsers like Google Chrome or Firefox, a popup will appear prompting you to install the Office extension, which is necessary for the browser to access the clipboard. This extension enables clipboard access through the Clipboard API.
In summary, Microsoft Office Online uses the Clipboard API to access the system clipboard, which is supported by Microsoft Edge and facilitated by an extension in other browsers.
For more details on the Clipboard API, you can refer to Clipboard APIs: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API
I hope that clarifies your query. Please try with the “Ctrl+C” and “Ctrl+V” and let us know if you face any issues.
Regards,
Ankit