I can't get how to add line breakers to a copy buffer that then can be pasted in google sheets with breaking lines. I need a HTML (br / p) behavior. When we select text with such line-breakers and past it line-by-line in sheets.
I don't want to create a new window for that:
let string="";
document.querySelectorAll('p').forEach(el => {string+= el.innerText + "<br/>"});
let newWin = window.open("", "Title");
newWin.document.body.innerHTML=string;
newWin.getSelection().selectAllChildren(newWin.document.body);
newWin.execCommand("copy");
}