37

Every time I copy and paste from a Google Spreadsheet, it adds a double quote before and after everything, and duplicates every single double quote.

For example, if I copy:

This is a "string" of sorts.

And paste ANYWHERE else (I can reproduce it on Windows, Mac, Linux, Notepad++, SublimeText, Xcode...) it results into:

"This is a ""string"" of sorts."

How can I copy and paste so that A" results in A" instead of "A""?

EDIT: I am talking about when you copy an entire cell, if you enter edit mode in a cell and copy the contents, the copy works fine. But you cannot copy formula-based cells this way, or multiple cells.

6
  • I can't reproduce your results. I've taken the exact string in Google Spreadsheets and copied it to an Outlook mail (native), notepad (Window 7), all yielding the same string !! I used Crtl+C and the way to copy from within the spreadsheet.
    – Jacob Jan
    Commented Mar 12, 2013 at 12:06
  • If you click the cell first and copy the contents of the cell (not the cell itself) it will work. I am having this issue specially with concatenated strings (because there are no contents to copy beside the formula).
    – speeder
    Commented Mar 12, 2013 at 13:37
  • 1
    I can’t reproduce your results either. Even after you edited it.
    – Alex
    Commented Mar 14, 2013 at 17:16
  • 4
    I have this problem as well, it seems to happen whenever I insert a line-break. The output looks fine in the doc but the extra quotes show up when pasting. This formula should reproduce the problem: ="This is a ""string"" and "&CHAR(10)&" a linebreak" Commented Jun 13, 2013 at 16:30
  • 2
    @BenCollier with linbreak this is by design, because otherwise it cannot know if it's break to next row or linebreak within cell (currently you can copy & paste any cells, even if they contain linebreaks). Alex, can you confirm there is no linebreaks in the cells you copying? Commented Jan 11, 2014 at 22:16

11 Answers 11

31

I found a workaround for this:

Just replace all "\n" symbols (LF - Line feed or 0x0A in ASCII) that's represented by CHAR(10) in Formulas by "\r" symbols (CR - Carriage return or 0x0D in ASCII) that's represented by CHAR(13).

And when you copy and paste as plain text it will be without added quotes in it.

Here is formula to do it:

=SUBSTITUTE(A1,CHAR(10),CHAR(13))
4
  • 2
    Thank you for the solution. It was painful to do post processing. You are awesome.
    – mslugx
    Commented Oct 21, 2020 at 8:57
  • 2
    Unfortunately, this removed all my line breaks. Commented Oct 27, 2020 at 12:47
  • 1
    Didn't work for me. Still leaving two doublequotes instead of correct one doublequotes.
    – Jonny
    Commented Jun 15, 2022 at 8:59
  • Brilliant, I'm quickly creating some config JSON files in Sheets, pasting them into VSC Code, and committing them into a GitHub repo. Works on Win10. Commented Dec 15, 2022 at 10:16
8

This is most likely due to new lines or tab characters in your data. If so, you can wrap your formula or the cell you need as shown, in clean, for example: =clean(A1).

From the docs, clean does this:

Returns the text with the non-printable ASCII characters removed.

2
  • 1
    Underrated answer! Thanks :)
    – Jo-el
    Commented Sep 11, 2020 at 0:11
  • This removes new lines.
    – Jonny
    Commented Aug 20 at 3:25
4

The "issue" is that Google Spreadsheet is putting valid CSV-formatted data into the clipboard.

The workaround is to publish the spreadsheet to the web (File -> Publish to Web) and copy out of that document instead.

It's not much of a solution but it can save you some time.

1
  • Note: this is identical to Geoff Gerrietts' answer in Google Products forum
    – user135384
    Commented Jan 24, 2017 at 21:35
3

What just worked for me, after having tried copying a cell that was generated by a formula (with line breaks and some single quotes) and didn't work correctly pasting to NotePad and NotePad++, was copying to a Google Doc (or to Microsoft Word, but why do that instead?).

Google Doc and Word both displayed the wanted result.

Select what you want to copy from Google Sheets, Control-C to copy (or use the menu), make a new or open an existing Google Doc (or Microsoft Word), Control-V to paste, or use the menu.

5
  • 1
    Not very clear.
    – serenesat
    Commented Jul 7, 2016 at 15:07
  • Select what you want to copy from Google Sheets, Control-C to copy (or use the menu), make a new or open an existing Google Doc (or Microsoft Word), Control-V to paste, or use the menu. Commented Jul 8, 2016 at 16:49
  • 1
    When copying a spreadsheet into Google Docs, it pastes as a table. You can then copy the data again from Google Docs, and this time it won't do the quoting.
    – sffc
    Commented Oct 17, 2017 at 2:51
  • 1
    Thank you. Working fine tested on 17-06-2021 for new people coming here!
    – Manoranjan
    Commented Jun 17, 2021 at 14:29
  • 1
    Still working in 2024
    – Jerther
    Commented Jan 24 at 16:00
2

My approach in this situation is to copy formula-generated cells (Ctrl-C) and values-paste them elsewhere on the sheet (Ctrl-Shift-V). The new cells are no longer formula-generated, so the approach described in the question works, in either of two forms:

  1. Double-click, select all, copy

or

  1. Click the formula bar, select all, copy

Either 1 or 2 requires copying one cell at a time; but for one or a few cells this is not too bad.

1

The function you're looking for is T() which returns string arguments as text. This should effectively treat the contents as if they were not calculated when you copy and paste. Some people have suggested using CHAR(13) instead of CHAR(10) but that won't show newlines in some environments, so I like this approach.

=T(SUBSTITUTE("This\nis\nsome\ntext.", "\n", CHAR(10)))

I hope it works for you.

1
  • 1
    When I copy and paste the output of this formula, it still has the quotations.
    – Vincent
    Commented Jan 18, 2022 at 0:54
0

Try pasting without formatting: Ctrl+Shift+V (or Command+Shift+V).

1
  • 1
    I tried here on a OSX (command+shift+v) copying to sublime text, did not worked.
    – speeder
    Commented Dec 9, 2013 at 18:44
0

You can use combination of multiple answers which are here.

Lets say that you have your data in cells A1:A10 computed from formula.

Here are steps to copy them out:

  • select cells A1:A10 and copy the content by ctrl + c
  • click on B1 and press ctrl + shift + v or right click and select Past values only
  • then click on B11 and to that cell enter formula =concatenate(B1:B10) this will "merge" the cells into one
  • click on cell B11 and copy the content by ctrl + c
  • click on C11 and press ctrl + shift + v or right click and select Past values only
  • and finally double click on C11 and copy the content out to your file

Warning: I tested this only on string generated data by formula. If the output of your formula are numbers, I am not sure if this will work... Also for large datasets this may not work... but for me it worked with 100+ rows..

Also the concatenate function will merge the data so the result is one big chunk of text. You may need to insert on the end of each row some "token" which you will then replace with new line...

0

I recently had this same issue, and there's another workaround.

Instead of copying the data by highlighting the cell and using Ctrl+C or selecting Copy, instead, highlight the cell and then copy the data that's in the formula area instead. This won't add the extra quotes.

0

I was using a Google Spreadsheet to generate a YAML output from tabulated values and was also running into the issue that each cell (containing line breaks) was quoted when I copied the output column from the spreadsheet.

I found out that this can be worked around to some extend by adding a formula cell similar to the following to a separate spreadsheet:

=CONCATENATE(Output!X2:X)

(assuming that the cells you want to output are in column X starting from row 2 in spreadsheet Output) This formula cell will then contain the contents of all output cells concatenated into a single string cell (make sure to end each cell value with an explicit line break). If you copy that cell, the entire value will still be quoted, but these two quotes are obviously much easier to remove.

-1

Got the solution right here.... (see example sheets file in this link)

To sum it up: If you can live without linebreaks in the text you are generating within a cell, then you will be able to paste without quotations. the line-breaking can then be done in the destination file.

Exhaustive example in the link above.

2
  • 3
    Always include essential part of the link into answer.
    – serenesat
    Commented Jan 31, 2016 at 14:43
  • i don't understand why this answer was downvoted, is the simplest answer if you can live without line breaks then remove them and google wont add in the additional " Commented Jun 3, 2022 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.