Help with Batch Macro for multiple TXT files w/differ schema
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi all,
I am trying to figure out how to create a batch macro to pull in all the TXT files from a particular directory. The TXT files may have some of the same fields and others will have extra columns - therefore different schema. In the actual workflow, I am assuming I will use a Directory tool first, but I am not sure what to do after that. Do I need a Dynamic Input tool after the Directory tool and then add the batch macro after the Dynamic Input? I am not sure how to configure everything. If it is a TXT file, I'm assuming I don't need to define a "sheet" like an Excel file, correct? If someone could refer to me to workflow with a connected batch macro that would be great. I tried looking all around and a lot of the batch macros I have found are for Excel files and not TXT. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @ELPC - Have a look at this: https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/CS-Macro-Dev-Reading-in-Multiple-Fi...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks, I will take a look but again, it is an example based upon Excel files that require a sheet name. I am uncertain if I need to include a sheet name in the fullpath for the batch macro for a TXT file. Do you know? I have created a batch macro for Excel files before that worked but I just can't get it to work for TXT files. That is why I'm asking if someone can direct me to a specific example for TXT files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@ELPC
I think we need to know your delimiter used in all your text files.
A few samples would be better.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi, the TXT files are comma delimited. Unfortunately, these are not my files so I let me try to mask the data to provide some sample files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
This is what I have so far:
This is what is coming out of the formula tool:
This is what the macro looks like:
I'm still getting this error: I'm not sure where I am going wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi, I too am running into same issue. Were you able to solve for this problem? If yes, could you share your solution? TIA
![](/skins/images/5A278AAD67B5F68761E04A0A1AFFBB3D/responsive_peak/images/icon_anonymous_message.png)