Q: Csv to Xls conversion problems. I have a small problem with the conversion of .csv to .xls files. My original file is separated by ; saved as .txt.
- I also tried with a comma separated .csv and I get the same result.
- I also tried to import full csv as text
- I also tried adding a header
- I still get the same result
I have attached some screenshots, I have also attached the txt file to convert. My file contains data in French with accents, can this have an impact?
A: It looks like a problem with the encoding of the txt file. We converted it to UTF8 first using a Pascal Script and afterwards the conversion worked just fine.
1. Open the Pascal Script option:
2. Enable and add the following ‘On Destination’ Pascal Script. This will first change the Encoding of the Source txt file to UTF8. The conversion to XLS was ok afterwards.
Var tmpFile: String; Begin psExitCode:= 0; // ... add your code here tmpFile := psFilePath + psFileName; If psChangeTxtEncoding(tmpFile, tmpFile, 0) Then psExitCode := 1; End.
More information about the “psChangeTxtEncoding function”:
Use psChangeTxtEncoding to convert the encoding
> Encoding possibilities:
7: ASCII TRIM
8: ANSI TRIM
i.e. psChangeTxtEncoding(psFilePath + psFileName, psFilePath + psFileName, 0);
This script will change the encoding of the original source file before it is converted to .xls using XLS as Destination.
Some extra screenshots of the XLS as Destination setup:
#Filetransfer #csv #xls
If you need any info about this ‘conversion problems’ issue, please let us know.