What I have:
A bunch of CSV files with data. Say 300k rows each one.
CSV files: if opened directly, they're in the wrong encoding and characters don't show up as they should. There's no option to select which
encoding to use or which should be the default for all files?
What also doesn't work:
Converting to xls/xlsx using an excel vba batch convert:
https://www.extendoffice.com/documents/excel/4615-excel-batch-convert-csv-to-xls-xlsx.html
Obviously this code just opens the file directly then saves under the new extension, doesn't solve the encoding thing. (also errors on the xlsx file on opening)
What does work:
Importing from file - CSV
Defaults to Western European but can be manually changed to 65001: Unicode (UTF-8) which works and shows special characters.
What I'm trying to end up with:
1. A batch script like the above one to convert files but would work off an import (and setting the encoding to UTF) as opposed to a direct open, that'll convert all csv files in a folder to xls with the right encoding.
Is this possible somehow with VBA?
2. A script that imports each csv file to the current workbook, each in a different worksheet. or similar.
Number 1 is the priority but any examples I can find uses the standard open vba code, meaning it'd not have the right encoding.
Alternatively if anyone knows how to force Excel to open a csv file with Unicode encoding, that'd also help!
Thanks for any input!
A bunch of CSV files with data. Say 300k rows each one.
CSV files: if opened directly, they're in the wrong encoding and characters don't show up as they should. There's no option to select which
encoding to use or which should be the default for all files?
What also doesn't work:
Converting to xls/xlsx using an excel vba batch convert:
https://www.extendoffice.com/documents/excel/4615-excel-batch-convert-csv-to-xls-xlsx.html
Obviously this code just opens the file directly then saves under the new extension, doesn't solve the encoding thing. (also errors on the xlsx file on opening)
What does work:
Importing from file - CSV
Defaults to Western European but can be manually changed to 65001: Unicode (UTF-8) which works and shows special characters.
What I'm trying to end up with:
1. A batch script like the above one to convert files but would work off an import (and setting the encoding to UTF) as opposed to a direct open, that'll convert all csv files in a folder to xls with the right encoding.
Is this possible somehow with VBA?
2. A script that imports each csv file to the current workbook, each in a different worksheet. or similar.
Number 1 is the priority but any examples I can find uses the standard open vba code, meaning it'd not have the right encoding.
Alternatively if anyone knows how to force Excel to open a csv file with Unicode encoding, that'd also help!
Thanks for any input!