Getting Data In

Splunk csv Export and Scientific Notation

OldManEd
Builder

Here is my problem. I have a search that creates a table. The table contains a column called Product_ID, a large numeric value of 15 digits. When I export the table as a csv file in Splunk, and read it into Excel, the column is turned into a scientific notation value. I ~need~ it to be a string. I’ve tried using "| eval field_name = tostring(field_name)", in the search, but that did not work.

I did see that the exported csv file created has all the strings encapsulated in double quotes, but all the numbers are not.

Any ideas on how to get the export csv file to force everything to strings?

0 Karma

emiller42
Motivator

You don't need to do anything special in Splunk for this. Just change the formatting in Excel from 'General' to 'Number'. You may also need to remove decimal places, but that's trivial. (See below) It's worth noting that the change to scientific notation (and all formatting changes) in Excel are all in display only. The underlying data is not modified, and no precision is lost.

If you ~really~ need it to be a string, you can do something like the following:

index=_internal | head 10 | eval foo=1234567890123 | table foo | eval foo2="\""+tostring(foo)+"\"" 

Excel General Formatting

Excel Number Formatting

0 Karma

OldManEd
Builder

emiller,

Thanks. Adding (foo2="\""+tostring(foo)+"\"") to the search worked. I understood your suggestions about setting up Excel to accept and display the data correctly, but my user community wanted to simply 'click' on the email attachment and examine the data in excel without any extra work.

Thank you again.

0 Karma

OldManEd
Builder

I did exactly that in wordpad and saw the strings were encapsulated in double quotes but numbers were not. (i.e., “string”, 1122334455667788). What I need to do is force the numbers to strings in Splunk. I tried to use the “tostring()” function in Splunk, but that did not encase the numbers in double quotes.

0 Karma

somesoni2
Revered Legend

I guess Splunk exports values in correct format only (you can verify it by opening the csv file in textpad/notepad). Its is Excel who converts this text which holds a numeric value into number automatically.

0 Karma
Get Updates on the Splunk Community!

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...

Data Management Digest – November 2025

  Welcome to the inaugural edition of Data Management Digest! As your trusted partner in data innovation, the ...