I am not coding in .Net but am using System.Windows.Clipboard
from the PresentationCore assembly to access the system clipboard to paste information copied in Excel.
When Excel copies to the clipboard I can retrieve it as text with System`Windows`Clipboard`GetText[]
. This text follows the TSV file format which I can parse and consume in my code (Wolfram Language).
Is there a way that I can query System.Windows.Clipboard
to determine if Excel is the application that pasted its current data into it?
I would like to restrict the paste operation in my code to only evaluate if the data on clipboard is from Excel. I looked at the online MSDN documentation page but did not notice a method that would give this information.
You should be able to use GetText(TextDataFormat.CommaSeparatedValue)
instead to determine whether the clipboard contents are actually CSV. That way you don't have to care at all whether Excel copied it, or Google Docs, or OpenOffice Calc.