Loop Excel file and write for each cell a text document

limegreenman900
limegreenman900 New Altair Community Member
edited November 2024 in Community Q&A

Hi everyone,

 

I am stuck with a hopefully pretty easy problem. I am using "Process Documents from files" operator and within it a "Cut Document" operator. What I want to do, is to extract a specific section out of my input documents. Is there any chance, I am thinking of a loop operator, to get for each input file an according output file (in txt or csv) that only contains the result of my "Cut Document" operator (not mandatory but nice: if the output files could have the same file names as the input files)? Up until now I use "write excel" but this gives me only a single excel file containing all outputs....

 

Any help appreciated.

Tagged:

Best Answer

  • bhupendra_patil
    bhupendra_patil New Altair Community Member
    Answer ✓

    When using PRocess documents from files you can check the "add meta information checkbox. Then it will automatically add a new column to the output example set called as metadata_file that will get you the file name. There is also complete path variable. See the attached process, You will need to modify it to point to your directory and cut logic.

    But then I am setting up a macro and then saving with the macro in file path

     

Answers

  • MartinLiebig
    MartinLiebig
    Altair Employee

    Hi,

     

    If you use loop files and process documents you could use the given file_name macro to do this.

     

    ~Martin

  • bhupendra_patil
    bhupendra_patil New Altair Community Member
    Answer ✓

    When using PRocess documents from files you can check the "add meta information checkbox. Then it will automatically add a new column to the output example set called as metadata_file that will get you the file name. There is also complete path variable. See the attached process, You will need to modify it to point to your directory and cut logic.

    But then I am setting up a macro and then saving with the macro in file path

     

  • limegreenman900
    limegreenman900 New Altair Community Member

    @bhupendra_patil: Works perfectly! Thanks for this uncomplicated and neat solution!