PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, August 9, 2022

[FIXED] How to read in decimals with dot-seperator correctly with Excel?

 August 09, 2022     csv, decimal, excel, formatting, windows     No comments   

Issue

I am trying to read in a CSV file in Excel which contains decimals with several decimal places. My procedure:

  1. Click Data upper Tab
  2. Click From Text/CSV
  3. Choose my file that I want to read in
  4. Click Load

If I open the csv with a text editor, the file looks as follows:

Label pre-annotated,Label self-annotated,Begin pre-annotated,End pre-annotated,Begin self-annotated,End self-annotated,Difference Begin,Difference End
P,P,0,3.36998958333333,0,3.36998958333333,0,0.0
P,P,5.50998958333333,5.85998958333333,5.50998958333333,5.85998958333333,0.0,0.0
P,P,6.37998958333333,6.67998958333333,6.37998958333333,6.67998958333333,0.0,0.0
P,P,6.80998958333333,7.80998958333333,6.80998958333333,7.80998958333333,0.0,0.0
P,COND1,10.3299895833333,10.36996875,10.3299895833333,10.517009268921914,0.0,0.14704051892191394

where the decimal places start with a dot. However, after loading it into Excel the dots are not recognized and the table looks as follows:

Table loading in, numbers are not formatted correctlty

I tried changing the Excel decimal separator to dot and comma, but it did not help. Even when changing decimal separator to dot in Windows, it does not work.

Any help would be appreciated.


Solution

As comments have pointed out, this seems to be a regional issue with separators. Changing the separators in the Windows system or in Excel did not help with this problem.

The workaround that I found was adding SEP=, as the first line to my CSV file in a text editor.



Answered By - Sven
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing