Hi Community,
I have built the batch macro input for CSV file based on the concept of xlsx but it seem like not working in this case as it show the error as below. Could anyone can help me to look into the alteryx solution and guide me which part need to be amended?
Basically i would like to ask the alteryx to read the csv file (which is different schema) and extract the following data
1. File name for each csv file
2. Each tab name for each csv file
Thank you so much for your help.
Solved! Go to Solution.
Hi @SH_94
Part of the problem is that csv files don't have sheet names, they are just text files at their core. If you really just need the file name the directory tool alone should work
Hi @Luke_C ,
Thank you for your swift response.For the directory tools, will it work if i have the CSV file with different schema? Could you show me how it need to be amended in the workflow to deal with different schema files.
Thank you.
Hi @SH_94
No problem. Are you looking to get the actual data from the files, or as your first post mentions just the file name? If it's just the filename the directory tool doesn't care about schema, putting *.csv as the file specification will return any csv files from the path you put.
If you need the data in each, I think you would need to provide a bit more information around what is ultimately expected as an output.
Hi @Luke_C ,
Yes. Basically i would like to extract the file name and data for each file (different schema). The concept of the workflow which i would like to build is as per screenshot below but i not sure how to amend it based on the workflow that i shared in the first post.
Could you assist me on this on how can i build the workflow so that it able to read the data as per screenshot above?
Thank you again for your time.
Hi @SH_94
Give this a try, it should work after I cut out a lot of the unneeded macros around sheets. If you're all set please be sure to accept the solution.
Hi @Luke_C ,
Thank you for the prompt response.
Yes. It is the macro that i looking for . I have tried to use it to read my CSV file and noted that it give the errors as below.May i know how can i solve the issue in this case?
In addition, i just checked the file name and it shows in the format below which i not sure how to extract the file name from this column .
Many thanks again for your help.
Hi @SH_94
For the filename, change this setting in the input tool of the macro:
For the error message, this means that in row 67 of the file there are more fields than headers, for example, if your csv has 6 headers defined, and there is a row with 7 fields in it, you will get an error. This could be because of a stray comma or bad data. You can either correct the data at the source, or use \0 as the delimiter. \0 will make it so the data is read in as-is, and you could then use the text to columns tool to help parse the data appropriately.
Hi @Luke_C ,
Thanks a lot for your swift response.
It is working now and thanks again for the great explanation on how to modify and correct the error.
Thank you so much.
Hi @Luke_C ,
I am trying to use the text to column function and it does not split the header name accordingly.May i know how can i fix this issue ?
Thank again for your help.
User | Count |
---|---|
63 | |
28 | |
23 | |
23 | |
22 |