1
$\begingroup$

Im trying to get my program to import a .xls for manipulation, I need to import the .xls at an url location dynamically, I did have this at the beginning of my code:

url = "http://www.doc.gold.ac.uk//~ma302jh//RegressionExample.xls"

t = Import[url];

I got my code working from the same URL location all the time, but now I want to put the dynamic input field in the manipulate function in order to upload any table I wish at any time, I have tried variations of this example below

Manipulate[

 If[url =!= "", WolframAlpha[url], "Enter URL"], {{url, ""}, 

  InputField[Dynamic[url], String] &}, t = import[url],

But im having a lot of trouble understanding the documentation and syntax regarding both manipulate and how I can import a table within manipulate.

My overal aim is to have an url input field in my code, the program will then map the table data plot points

$\endgroup$
1
$\begingroup$

Does this answer you first concern?

 Manipulate[
  t = Quiet[ Check[Import[url], {{"error, please provide a valid link"}}]];

  Pane[TableForm[t], {Full, 300}, Scrollbars -> True,  AppearanceElements -> None]
  ,
  {{url, ""}, InputField[#, String, ImageSize -> {500, 35}] &},
  {t, None}
 ]

enter image description here

You can achieve this in many ways, the question is what is the final goal, for more complex UI please consider writting everything in terms of DynamicModule+Dynamic instead of Manipulate.

| improve this answer | |
$\endgroup$
  • $\begingroup$ I get the error :Manipulate argument t=Quiet[Check[Import[url],{{error, please provide a valid link}}]];{{url,},doc.gold.ac.uk//~ma302jh//RegressionExample.xls&} does not have the correct form for a variable specification. >> $\endgroup$ – Jethro Devøn Feb 22 '15 at 17:40
  • $\begingroup$ How could I rewrite this in terms of dynamic module or would their be too much to do? also the final goal is to be able to put the url of any table in and have the program use it smoothly. $\endgroup$ – Jethro Devøn Feb 22 '15 at 17:41
  • $\begingroup$ I get errors but that's because i'm trying to mix it with all the other stuff, on its own it does work, but with the stuff that I actually need in manipulate, wierd errors $\endgroup$ – Jethro Devøn Feb 22 '15 at 21:09
  • $\begingroup$ Okay I understand you, wait a mo $\endgroup$ – Jethro Devøn Feb 23 '15 at 1:12
  • $\begingroup$ Okay by saying table data I actually meant utilise the data from a .xls, I jsut want ed an input field so that the url containing the data to import waasnt hardcoded $\endgroup$ – Jethro Devøn Feb 23 '15 at 1:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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