| ▲ | sfn42 4 days ago |
| You don't need to auto-detect the format. The delimiter can be declared at the top of the file as for example sep=; |
|
| ▲ | yrro 4 days ago | parent | next [-] |
| But now that's not CSV. It's CSV with some kind of ad-hoc header... |
| |
| ▲ | sfn42 4 days ago | parent [-] | | It may not be part of any official CSV spec but Excel accepts it. I found that Excel would read my files much more reliably using the sep declaration, which is great when the target audience is less technical types. |
|
|
| ▲ | tacker2000 4 days ago | parent | prev | next [-] |
| Ok thats a nice tip, but to be fair when i download some CSV report off some website, i dont wont to open it to check the delimiter, then edit it and resave it.
Often I am downloading dozens of such files at a time. |
| |
| ▲ | sfn42 4 days ago | parent [-] | | The idea is that the program that creates the file adds that line at the top. If you're downloading CSV files from websites then ideally they should already have that line. If they don't then what you could do is create a simple script that just adds that line, and Excel will open the files without you having to hassle with making sure Excel interprets them correctly. Of course that's a bit more challenging if they use different separators, but you might be able to find an easy adaptation for your usecase like making a decision about which delimiter to declare based on the filename. Or you could try to analyze the header row to figure out which delimiter to use based on that. | | |
|
|
| ▲ | IAmBroom 4 days ago | parent | prev [-] |
| I love you forever and a day. Thank you. |
| |