the link was supposed to be helpful in a way to familiarize you with node that actually does the job. Thing that was missing was creating a dictionary table for which you found a nice approach.
regarding reading multiple Excel files in one Excel files here is example with .txt files but it is pretty much same as one you linked. Note that all files need to have same structure/columns otherwise you need extra data manipulation/transformation for this to work.
In workflow attached I have extracted file name so you can use it to join with data from XPATH or to filter that data and then insert appropriate column headers. I would try to this logic inside a loop but not sure what is your use case so maybe you can do it after concatenating all Excel files
Current i want to loop the csv files. Its easy with Loop/CSV-Reader and URL as Input-Location.
But the really hard Problem is to get a dynamic XPATH. Like the picture above i’ve a xml reader. In this Reader i must do a dynamically loop, The file looks like
<Table>
<URL>Dateiname.csv</URL> // IMportant because dataname
<Name>Dateiname</Name>
<Description>Description</Description>
<DecimalSymbol>,</DecimalSymbol>
<DigitGroupongSymbol>.</DigitGroupingSymbol>
<VariableLength>
<VariablePrimaryKey>
<Name>Spalte1</Name>//important because column name
<Description>wayne</Description>
…
Next uRL
Function is. Select URL with Name = Dataname
Select all VariablePrimaryKey/Name from this URL.
Do you mean you have always 2 files, one is a CSV and the other one is an XML and the CSV file name and the column name are specified in the XML and they may change each time you run the workflow?
If the XML structure is always the same then what is the problem? You can use the same XPath every time.
If the XML structure changes, it may be possible to edit the XML file with a String Manipulation node first to produce the same XML file each time you run the workflow and then extract the names.
Please explain the situation a bit more and if possible provide a sample data so we can investigate your issue much better.
Well. You see in Workflow that the CSV-Files are in one List.
I’ve also an XML File. In this File are the Headers. I want to add the headers from the xml file to the CSV-Files.
There are just 1 XML-Files with all named Files and all Headers.
Thats Why the Xpath is changing. Example below
<Table>
<URL>Dateiname.csv</URL> // IMportant because dataname
<Name>Dateiname</Name>
<Description>Description</Description>
<DecimalSymbol>,</DecimalSymbol>
<DigitGroupongSymbol>.</DigitGroupingSymbol>
<VariableLength>
<VariablePrimaryKey>
<Name>Spalte1</Name>//important because column name
<Description>wayne</Description>
<VariablePrimaryKey>
<Name>Spalte2</Name>//important because column name
<Description>wayne</Description>
<VariablePrimaryKey>
<Name>Spalte3</Name>//important because column name
<Description>wayne</Description>
<VariableColumn>
<Name>Spalte4</Name>//important because column name
<Description>wayne</Description>
<Table>
<URL>Dateiname2.csv</URL> // IMportant because dataname
<Name>Dateiname2</Name>
<Description>Description</Description>
<DecimalSymbol>,</DecimalSymbol>
<DigitGroupongSymbol>.</DigitGroupingSymbol>
<VariableLength>
<VariablePrimaryKey>
<Name>2Spalte1</Name>//important because column name
<Description>wayne</Description>
<VariablePrimaryKey>
<Name>2Spalte2</Name>//important because column name
<Description>wayne</Description>
<VariablePrimaryKey>
<Name>2Spalte3</Name>//important because column name
<Description>wayne</Description>
<VariableColumn>
<Name>2Spalte4</Name>//important because column name
<Description>wayne</Description>
One general note from my side. You can put all files associated with workflow in workflow directory (create folder named data for example) and use relative paths to import data from files in your workflow. This makes things easier for you (less uploading) and people who are interested in your workflow (less downloading and most importantly no need for configuring paths!)
Hi,
thank you very much for your example. I test it and its really good.
But my File-Structure is a little bit different. I updated the xml file. Its little bit difficulter.Preformatted text
Your XML still has several errors in closing tags. Here is the modified version: updatenames.xml (1.4 KB)
And here is the modified version of the workflow regarding the XML structure: xml_headers.knwf (59.4 KB)
The change here is that we have to create 2 XPath queries. One for the <VariablePrimaryKey> tags and the other one for the <VariableColumn> tags. And then we have to concatenate the columns we have. I did that using a loop construct with a Column List Loop Start node and a Loop End node.
If you have a more complicated XML structure, just add XPathes like how I did. I have created the XPath queries in the Variable Expressions node.