How to remove leading and trailing double quotes from Google Sheets?
It is so frustrating and annoying when I copy from a Google Sheets cell and it automatically either puts double quotes around the entire string or text. Especially with certain items like code it breaks all sorts of things.
A. Does anyone know why this is done? Is there any value around it? It seems to happen whenever there are multiple lines within a cell.
B. Is there a way to disable it globally?
You can remove leading and trailing double quotes from text in Google Sheets using a combination of functions. Google Sheets offers a function called SUBSTITUTE
, which can be used to replace specific characters within a text string. To remove leading and trailing double quotes, you can use the SUBSTITUTE
function along with the MID
function. Here’s how to do it:
Let’s assume the text you want to remove double quotes from is in cell A1. You can put the following formula in another cell, such as B1:
excel
=SUBSTITUTE(MID(A1, 2, LEN(A1)-2), """", "")
Here’s what this formula does:
MID(A1, 2, LEN(A1)-2)
: This part of the formula extracts the text from cell A1, starting from the second character (to skip the leading double quote) and ending at the second-to-last character (to skip the trailing double quote).SUBSTITUTE(..., """", "")
: This part of the formula replaces all double quotes in the extracted text with an empty string, effectively removing them.
After entering this formula in cell B1, it will display the text from cell A1 without leading and trailing double quotes. You can then copy the result to another location or cell if needed.