Using clipboard (Twice or more)

Hi, is there any way to grab from a specific cell within google sheets its content (copy it to the clipboard), then execute a snippet regarding to clipboard, and then move to a another specific cell grab its content (copy it to the clipboard) and execute another snippet also regarding to the second clipboard?

Best regards,
Martin

Hi @martinhgps,

So if I understand correctly, you're talking about doing this in two stages, with two snippets. This is important because once you've typed the snippet's shortcut, the clipboard contents that it "remembers" will remain the same until the snippet is actually inserted, even if you copy something else to the clipboard.

Now, let's talk about processing the contents of a spreadsheet when they've been copied to the clipboard.

Here's a snippet that I created some time ago:

For it to work, you have to highlight the whole contents of the spreadsheet and copy the to the clipboard.

This snippet uses the split function to break up the contents of the clipboard by tab stops and line breaks. Rows and columns each have a number assigned, and when you choose your row/column, this tells TB which part of the content you want.

I'll illustrate the concept in simpler terms:

The variable content has those four items, separated by line breaks.
{content=
"item1
item2
item3
item4"}

{list=split(content, "\n")}
With split function, I'm breaking up its contents by line-breaks - that's what "\n" means. This turns it into a list, which I've creatively named "list" lol.

If I just use the variable "list", here's what it produces:
{=list}

If you were to copy a whole row from a spreadsheet into your clipboard, and used the clipboard command, you'd see a very similar output.

Now, to get an intividual item from the list, we use the following syntax:
{=list[1]}
{=list[2]}
{=list[3]}
{=list[4]}