title: Get excel row as TXT string
body: <p>Delphi XE10. I need to read row by row from an Excel worksheet as a (tab-separated) string. What you get when you use 'select a row - copy - paste in Notepad'. The worksheet contains strings, numbers and dates in various formats.
  What works is this:</p>
  
  <pre><code>function TexcelSource.nextRow: string;
  var k : integer;
  begin
    result:=sheet.cells.items[currentRow,1].text;
    for k:=2 to maxCol do
        result:=result+tab+sheet.cells.items[currentRow,k].text;
    inc(currentRow)
  end;
  </code></pre>
  
  <p>where sheet is the reference to an excel worksheet (var Variant):</p>
  
  <pre><code>XLApp:=createOLEobject('excel.application');
  XLApp.Workbooks.open(filename) ;
  Sheet:=XLApp.WorkSheets[1] ;
  MaxRow:=Sheet.Usedrange.EntireRow.count ;
  MaxCol:=sheet.Usedrange.EntireColumn.count;
  </code></pre>
  
  <p>However, it is unacceptably slow. I have tried to import the whole sheet as an array in one step and read from the array:</p>
  
  <pre><code>sheetData:=Sheet.UsedRange.Value;
  </code></pre>
  
  <p>This is fast enough but I can't get all sheetData[row,col] as a string value. It returns cells with string value but stops at a cell with an integer value with error 'Could not convert variant of type (UnicodeString) into type (Double)'. (VarType of that element seems to be vtPointer - which I do not understand; neither do I understand the error.)</p>
  
  <p>I have also tried copy and paste via the Delphi Clipboard. Works for a while and then the clipboard becomes unavailable. Anyway, that is not an approach I like for an operational system.</p>
  
  <p>I would welcome suggestions on how to read a worksheet row as a string with acceptable performance.</p>