# How to prevent conversion of number forms to numbers in Import [ webpage, "Data" ]?

I have tabular data on a webpage. It looks like this:

Import["http://mfvonh.me/numericalTable.html", "Plaintext"]


1.0

1.1

3.53

However, I have many columns, so I want to import it using "Data":

Import[ "http://mfvonh.me/numericalTable.html" , "Data" ]


{ 1. , 1.1 , 3.53 }

I'd like to prevent Import from converting number-like forms to numbers, as it has done above, and simply extract all tabular data as strings. Obviously there are easy ways to hack this with a workaround; I am looking for an answer that involves Import[ _ , "Data" ].

I assume this conversion is somewhere in the Trace, but I was overwhelmed when I tried to look at it:

(Import["http://mfvonh.me/numericalTable.html", "Data"] //
Trace) >> "trace.txt"


produced 26 megabytes of plain text.

I took a look. Now I'm stuck.

• I guess you can leave out the edit, as long as it duplicates your answer. Jun 4, 2014 at 15:22

You should use the "Numeric" -> False option:

Import["http://mfvonh.me/numericalTable.html", "Data", "Numeric" -> False]


{"1.0", "1.1", "3.53"}

This option is listed under Options on the Documentation page for HTML.

Block[
{ToExpression},
ToExpression[ x_String /;
StringMatchQ[ x, RegularExpression[ "\\d+(\\.\\d+)?" ] ] ] := x ;
Import[ "http://mfvonh.me/numericalTable.html" , "Data" ] ]


{"1.0", "1.1", "3.53"}

• +1 for resourcefulness, although in this case your solution is an overkill. :) Jun 4, 2014 at 17:54