Copy external data & paste as 2D wave

I often need to copy data from something like Excel into Igor, but I usually want 2D waves instead of single columns. My present solution is ok, I execute

edit

then copy & paste and call this little snippet:

function tab2matrix()
    string tabName = WinName(0,2)
    string list = wavelist("*",";", "WIN:"+tabName)
    DoWindow/K $tabName
    Concatenate/DL/KILL/NP=1 list, data
end

but I was wondering if there is a better or even native way to do this. I could make it slight more efficient if I convince 

getscrapText()

to paste into a table, but I haven't found a way so far. 

Anyone an idea?

Thanks!

 

Just some quick ideas without really testing them:

- save GetScrapText() string into temporary text wave on disk and then invoke LoadWave. EDIT: OK, it seems LoadWave is even able to load from the clipbaord directly. Neat!

- parse GetScrapText() string manually (line breaks to rows and tabs to columns). For this, see also Tony's somewhat related code snippet: https://www.wavemetrics.com/node/20912

- if you want to paste the whole excel table, rather load the excel file directly?

In reply to by KurtB

chozo wrote:

- save GetScrapText() string into temporary text wave on disk and then invoke LoadWave. ...

- parse GetScrapText() string manually (line breaks to rows and tabs to columns). For this, see also Tony's somewhat related code snippet: https://www.wavemetrics.com/node/20912

- if you want to paste the whole excel table, rather load the excel file directly?

I only want pieces of the excel file. Usually columns with headers as dimlabels. I thought about saving and re-loading, but it seemed a bit clunky. I like Tony's idea to count \r and \t to get the dimensions of the matrix. That could be a way to paste cell by cell based. 

 

KurtB wrote:

How about something like:

LoadWave /G/M "Clipboard"

hmm, that looks very interesting, in particular if this works with the /U flag to get at least column labels - I need to play with that!

Thanks both!

 

 

EDIT:

actually, that does exactly what I want. I haven't even hoped for row labels initialy!

LoadWave/U={1,0,1,0}/J/M "Clipboard"