wks-dc-object
Data Connector added to a worksheet are handled as objects in Origin. The column attributes can be accessed and changed using the properties in the table below.
For workbook level controls of Data Connector, please refer to Wbk object.
EX1
//This example shows how to import a CSV file by Data Connector newbook; wbook.dc.add("CSV"); wks.dc.source$=System.path.program$+"Samples\Batch Processing\T275K.csv"; wks.dc.import();
EX2
// This example shows how to import multiple CSV files into one worksheet appending by rows newbook; string fname, path$=system.path.program$ + "Samples\Batch Processing\"; findfiles fname:=fname$ ext:="*.csv"; int num = fname.GetNumTokens(CRLF); wbook.dc.add("CSV"); loop(ii,1,num) { next$ = fname.GetToken(ii, CRLF)$; if (ii==1) { wks.dc.flags=256; // turn on append rows mode } wks.dc.source$=next$; Tree tr1=wks.dc.optn$; tr1.settings.partial.SetAttribute("Use", 1); tr1.settings.partial.row$="2"; // import 2nd row for each file tr1.ToString(wks.dc.optn$); wks.dc.import(); }