javascriptgoogle-sheetsclipboard

How to prepare string to paste in multiple Google Sheets cells skipping some cells?


I am trying to prepare a string in Javascript & putting it in clipboard, so that I can paste it in a Google Sheet one row multiple cells. I can insert the tab \t where I want the part of string to go to next column cell. E.g. X\tY\tZ will get pasted in cell A1 as X, A2 as Y & A3 as Z.

My question is, how do I prepare the string that it skips a column.

I have cells A1, A2, A3 & A4. The values I want in A1 is X, in A2 is Y, & I want to leave A3 as it is when I paste, & Z in A4. Similar to X\tY\t*Z but is there anything I can insert in place of *?


Solution

  • When you paste over cells, the new data replaces the old. You can add a blank column as \t\t but that will make the column blank instead of keeping the value already there. The easiest solution would be to re-order columns so that the column you want to keep is not in the middle of columns you want to replace.