google-sheetstextquotation-marks

How to avoid copying quotation marks in Google Sheets


I'm working on a Google Sheet that converts URL slugs and dates into a script. The problem I face is that when you copy the text that is being generated by a formula (that includes cell references and a TEXT formula) it also copies extra quotation marks that I don't need. Below you can find an example of the format I need to have when I copy the text from the cell.

Link to example Google sheet

In column B you can find the dates, in column I you can find the slug

var flashDeals = {
    "2023-03-29": [
    'f8dba2f9-d84f-4a42-9e53-99a3d200c3cb',
    '6ad034f4-255f-4739-a7f2-cce3927b6a4a',
    'a10f3c54-3332-48dd-9cfb-cd5cfa1f6797',
],
    "2023-03-30": [
    '420456df-32f8-4959-a76e-4dd9f5a752af',
    '193bbed5-3e82-48c7-9ff8-400156b5a2bb',
    'c81d1c00-6f6a-46e7-9c0b-e433d857874d',
],
    "2023-03-31": [
    'b0328bb8-a5aa-4404-83b7-26324a0e5f11',
    '5c8c7622-1fab-482e-8c6c-d71610b76ed5',
    '5b4db348-5473-490f-aa05-a84656bf48af',
]

At this moment when I'm copying the text in cell L2 I get this result:

"var flashDeals = {
    ""2023-04-07"": [
    'f258a4b2-7a53-46f4-b207-6822b3e61e3e',
    '5a1cc293-3955-403c-b548-6258ddccc6dc',
    'e2d860f5-1a4a-43f7-829b-e4e7bcbf360f',
],"

The weird thing is that when I see the cell the code looks good but when I copy the cell and put it in a notepad the quotation marks will appear again. I need to get rid of all the 'double' quotation marks. How can I solve this problem?


Solution

  • Try this in Cell M2 & then copy-paste in your notepad to see if you are are devoid of these additional quotes stuff...

    =substitute(L2,char(10),char(13))