Concatenate files from sharepoint

Hi!

I am new using the Knime platform, the challenge I am facing is to append all the files from a sharepoint folder and make them one to create a table and be able to use it inside an excel file.

I am not able to get the csv reader to work, please I appreciate your help if you have any examples I could check.

Hey Melanie,

you could potentially use the Files in Folder option in the CSV Reader node and read all files at once. You can have a look at the attached workflow :slight_smile:

Best regards
Lars

Edit: There are two files in the workflow data area namely “1” and “2” consisting of one row of data per file

concating_csv_files.knwf (17.5 KB)

Hi Lars!

I have trouble using the CSV Reader, when I execute it, the info is not showing. Could it be because the files have 2 sheets? I want to join just one of them from all the files.


The error indicates that the a file which is not the first has got more columns as the first one. You could check “support short rows”.

Hi Lars!

I try clicking the option mentioned but I still get all the data in codes, it doesn’t show the data from the excel file in the second tab.

Any idea how could I fix it?

If it is an excel file you should use the Excel Reader.

3 Likes

Thank you !! I manage to open the excel file but it only opens one of the files inside the folder. How can I do if I need it to open all of them and join them together in order to create a new file with them.

After I manage to do that, Is there a way that every time there is a new file, it is added to the file created with the other folder?

Hey Melanie,

what does the error say? I assume that it has something to do that the structure of those files are not identical? You could try to use the “Fail if schemas differ” Option in the Advanced settings tabs. As stated in one of my posts above you could use the loop and configure the Excel Reader node to read only one file or get rid of the loop and use the “Files in Folder” option of the Excel Reader node.

Hi Laaaarsi!

It says the following:

But the structure inside the files is the same, I selected the tab that I need and the lecture for the excel is the right one but just for one file.

Could you provide two (or more) excel files to test this? You could just leave the column headings and insert some dummy data.

18.08 p2 p4.xlsx (22.1 KB)
18.08 p1 p21.xlsx (20.3 KB)

Those are the example files I have in the folder that I need to merge

Try to check “allow changing table specifications” in your loop end node
br

2 Likes

Thank you so much!! It worked, is a way I can export that table to an excel or create a query?

And is there a way I could add the date the file inside the sharepoint was created as an additional column?

You can use the Excel Writer Node to create a new file from a KNIME Table. Regarding the date field you can use the Files/Folders Meta Info – KNIME Community Hub Node and append a new column.

Before adding the excel writer node I should add the table writer node? or how does the workflow should look like?

Thanks for all the help in advance

This is the error I am getting:

Probably what happened there is during the Loop End, some of the data from Excel had different types in the same column (for example, number AND string). This can cause KNIME to generate a column with a “?” column type. You could try the Table Manipulator node to change the type to what you need prior to writing to Excel.

1 Like

@Melanie_CH maybe you can take a look at this example how to import all the sheets from all Excel files in a folder and bring them into KNIME and export the collected data and write out another Excel File (per sheet name). You can obviously change the settings and methods of collection:

You could also check the additional examples.

kn_forum_71840_concatenate_excel_files.knwf (78.0 KB)

1 Like

Hi! How do I manage to change the type? with the table manipulator node?