At this moment, when I have a <textarea>
structured as follows:
<textarea>
1, 2, 3, 4
5, 6, 7, 8
9, 10, 11, 12
</textarea>
and then attempt to transfer the content to Excel, it prompts me to paste from a comma-separated source.
However, I prefer to use a div instead of a textarea. In my attempts to do so, I have used the following code:
<div style="white-space: pre">
1, 2, 3, 4
5, 6, 7, 8
9, 10, 11, 12
</div>
Unfortunately, when trying to paste into Excel from the div, it fails to recognize the content as comma-delimited data.
Is there a way to format a div in such a manner that enables copying and pasting plain text, thus allowing Excel to identify the delimited information?
I am hesitant to use a textarea due to not wanting the data to be editable. Additionally, the div adjusts to fit the content's height, which is something the textarea does not do.