Greasy Fork is available in English.

Google Sheets Unescape Double Quotes when Copying Multi-row text

Googleスプレッドシートで改行を含むセルをコピーするとき、コピーされるテキストにつくダブルクォーテーションをアンエスケープする。

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
// ==UserScript==
// @name         Google Sheets Unescape Double Quotes when Copying Multi-row text
// @description  Googleスプレッドシートで改行を含むセルをコピーするとき、コピーされるテキストにつくダブルクォーテーションをアンエスケープする。
// @namespace    https://github.com/pingval/
// @version      0.00a
// @author       pingval
// @grant        none
// @match        https://docs.google.com/spreadsheets/*
// @license      CC0
// ==/UserScript==

(function() {
    document.addEventListener('copy', function(e) {
        const from = (e.clipboardData || window.clipboardData).getData('text');
        //  改行を含まないなら何もしない
        if (!from.includes("\n")) {
            return;
        }
        // ダブルクォーテーションをアンエスケープ
        const to = from.replaceAll(/^"|"$/g, '').replaceAll(/""/g, '"');
        if (from != to) {
            console.log(from + ' => '+ to);
            //alert("コピーしたテキストのダブルクォーテーションをアンエスケープしました\n" + from + "\n↓\n"+ to);
            //GM_setClipboard(to, 'text/plain');
            (e.clipboardData || window.clipboardData).setData("text", to);
        }
    });
})();