Jun 25 2020 09:36 AM
Is there a way to paste formatted SQL code into a single Excel cell and retain the formatting? If I paste directly into the cell, the code spans multiple rows and keeps formatting but if I try to paste into a single cell by pasting into the format bar, it strips the formatting.
Here is a dummy sample of formatted code I am trying to paste:
SELECT DISTINCT field
FROM tablename (NOLOCK)
WHERE field Like 'L%' --Reasons starting with "L", per J.Doe
Jun 25 2020 09:57 AM
Jun 25 2020 10:05 AM
Hi @kbgriggs,
If this is what you want ...
The solution I have is to first get in edit mode of the cell (F2 or double click) and paste the first line followed by "Alt+Enter", paste the second line followed by "Alt+Enter", and so on until you're done.
"Alt+Enter" will create a new line in your cell.
This can take a while if you have hundreds of line to put in a cell though. Hopefully someone knows of a quicker solution.
Ben
Jun 25 2020 10:31 AM
Hi @Sergei Baklan! Thank you for your response. I am able to paste into the cell. What I am trying to figure out is a way to paste it so that my formatting stays. Here is an example of what I want it to look like in Excel. Currently, I am having to reformat word by word to get the colors I need for the code.
Jun 25 2020 10:32 AM
Hi @Bennadeau
Unfortunately no, that is not what I am trying to get to. Please see my response to a previous reply.
Jun 25 2020 12:26 PM
I see. Here to copy/paste from the site I used Paste as HTML, another sample is copy/pasting as HTML from Word
Not sure how it will work with other sources.