Excel Reader: String turns into Double

Hi there,
So I’ve bumped into an issue I just cant figure out. Been searching the forums and google, but cant find a solution.

Short story:
I’ve got an excel file with data. One of the columns contain phone number. In excel, it’s written as a string, like this: 4712345678
(47 = countrycode, last 8 digits are number).

When using Excel Reader (XLS) to read the file, it’s correctly identified and formatted as a string under File content tab in the config of the node.
But in the preview tab, it’s converted to Double. No mater what I do. I dont want any fields to change upon import. String should be string. :stuck_out_tongue:

This in turn makes it somewhat difficult for me to get back my original string of the phone number. All conversions from double back to string gives me results like: 4.712345678E9

I tried using a Round Double node, storing as String, and that turns it back into the right format.
But, I don’t want to find workarounds, I just want the input to be treated as string. It is identified as string, but for some reason it gets converted.

Thanks in advance for any help :slight_smile:

Hi @Stianbl

Maybe not a nice solution. but you can use the Round Double node, with ouput format “Standard String”.


gr. Hans

Thanks HansS,
This is the “solution” im using now. But for my workflows to work properly, i should not have to make workarounds like this. :slight_smile: for all i know, it could fail if i later get a new dataset where the column is correctly identified as string again.

What i find most confusing is the fact that it lists it as string under File Content tab in Excel Reader, but it turns into Double in Preview tab and for further use…

Edit: Image of the columns, from Excel Reader:
I understand partly what’s happening. In File Content, it sees the header as a string value, and determines the column is string. In Preview, it uses this row as headers, and there are no more “obvious” strings, so it just uses double. But I do not want to read it in as Double. I just want it to be a string.
2020-06-30_21-22-05

You could use R readxl and force the column type to be read as string. Also no generic solution.

CSV and Excel are widely used but bad at preserving data types.

2 Likes