2013-04-15 54 views

回答

2

有一個運算符Loop files,您可以使用它來遍歷文件目錄。在該運算符的子進程中使用Read Excel運算符。這樣的結果是ExampleSets的集合。處理一組示例集有多種方法。對於連接(要生成一個ExampleSet),請使用Append運算符。

下面是一個示例過程的xml:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<process version="5.3.007"> 
    <context> 
    <input/> 
    <output/> 
    <macros/> 
    </context> 
    <operator activated="true" class="process" compatibility="5.3.007" expanded="true" name="Process"> 
    <process expanded="true"> 
     <operator activated="true" class="loop_files" compatibility="5.3.007" expanded="true" height="76" name="Loop Files" width="90" x="782" y="30"> 
     <parameter key="directory" value="D:\xls"/> 
     <parameter key="filter" value="^.*\.xlsx?$"/> 
     <process expanded="true"> 
      <operator activated="true" class="read_excel" compatibility="5.3.007" expanded="true" height="60" name="Read Excel" width="90" x="782" y="30"> 
      <parameter key="excel_file" value="%{file_path}"/> 
      <list key="annotations"/> 
      <list key="data_set_meta_data_information"/> 
      </operator> 
      <connect from_op="Read Excel" from_port="output" to_port="out 1"/> 
      <portSpacing port="source_file object" spacing="0"/> 
      <portSpacing port="source_in 1" spacing="0"/> 
      <portSpacing port="sink_out 1" spacing="0"/> 
      <portSpacing port="sink_out 2" spacing="0"/> 
     </process> 
     </operator> 
     <operator activated="true" class="append" compatibility="5.3.007" expanded="true" height="76" name="Append" width="90" x="916" y="30"/> 
     <connect from_op="Loop Files" from_port="out 1" to_op="Append" to_port="example set 1"/> 
     <connect from_op="Append" from_port="merged set" to_port="result 1"/> 
     <portSpacing port="source_input 1" spacing="0"/> 
     <portSpacing port="sink_result 1" spacing="0"/> 
     <portSpacing port="sink_result 2" spacing="0"/> 
    </process> 
    </operator> 
</process> 
相關問題