I have a large txt data stored in this link.

I have tried this:

dataa = ToExpression[

But it's not working.

How can I import this data?

  • 1
    $\begingroup$ Import["https://www.dropbox.com/s/bkyoamgqop7kpio/data.txt?dl=1", "TSV"] works for me. You can also use "Table" as the second argument. $\endgroup$ – Jason B. Sep 6 '18 at 17:35
  • $\begingroup$ @JasonB. yes, this works for me too. Could you please post your comment as an answer? Thank you. $\endgroup$ – Diogo Sep 6 '18 at 17:38

There are two issues here. First, that Dropbox gives you a download link that goes to a web page, rather than serving the file directly:

StringTake[ Import[
  "https://www.dropbox.com/s/bkyoamgqop7kpio/data.txt?dl=0", "Text"] , 200]
(* <!DOCTYPE html><html xml:lang="en" class="maestro" 
   window._goch_ = {};
   window.addEventListener('click', function(event) *)

If you change the 0 at the end of the URL to a 1, you get the file:

  "Text"], 200]
41.66666670000001   0.  -48.27198359004478
36.458333340625 0.  -52.44199291767245
31.249999987500004  0.  -55.61381644250923
26.041666640625003  0.  -57.787454164553765
20.833333300000003  0.  -58.9629060838065

Next, there is the file format - the OP gives "JSON", but I don't think this is a valid JSON file, it looks more like a tab-separated-value file

1", "JSON"]

During evaluation of Import::jsonexpendofinput: Unexpected character found while looking for the end of input.

During evaluation of Import::jsonhintposandchar: An error occurred near character '0', at line 1:20
(* $Failed *)

So just use the "Table" import format:

  "Table"] // Short
(* {{41.6667,0.,-48.272},<<19438>>,{37.1875,<<10>>,2193.48}} *)

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.