Good day,
I have a monthly report that requires me to take weekly data, which has columns containing staff names, and the dates in the month.
How can I add them from a directory into my workflow. I added them individually however would prefer an alternative.
Files are in .CSV
Appreciate any assistance.
Hi,
Please check this post. It will guide you how to achieve your goal:
Good Luck!
Use only one input data tool, and replace the filename part with the wildcard * (eg. C:\Users\directorypath\*.csv)
It will pull all the csv files in the directory, and union them all together.
Attempted it and used a marco however information, its coming out like below which causing issues further down.
The below shows how i have it using my original method.
Hey, no it didn't work, it unions them as you said but different schemas.
You were using an union in your screenshot to join the files?
You can change the configuration of the union to configure by position rather than name - would that help?
Or, you can accept it loads as it is (the data is now all in your workflow, so that's a good first step!) but use a series of subsequent tools to pick out and align the columns (eg Field info, dynamic rename, and later union).
When i try that they end us stacking up, and lose the column names which are dates. Trying to add other tools to adjust it.
When you import the file using the import tool, there is an option within the configuration to include as a field the filename. It looks like your filename contains the date, so with the filename in the workflow you can use a formula tool to extract the date. I would be tempted to uncheck the "First row contains field names" and input the data as generic column titles. Once the data is in, you might consider Transform tool Transpose and perform some calculation (based on the filename date) on what the column headings should be, before crosstabing it back. Or perhaps a series of Field Info and Dynamic Renames... hope that gives you some ideas?