Tag Info

Hot answers tagged

16

Here is a manual method using copy-and-paste that is suitable for small volumes of data on an ad hoc basis... 1) Enter the following expression into a notebook, but don't evaluate it: data = ImportString["", "TSV"] 2) Copy the cells from the source spreadsheet onto the clipboard. 3) Paste the contents of the clipboard between the empty pair of quotes in ...


7

If you are familiar with AppleScript, you could try an approach like this: (* from http://github.com/fmeinberg/AppleScript *) AppleScript["RunFile", file_] := Run["osascript " <> file] AppleScript["RunScript", script_] := Block[{file = ToFileName[$TemporaryDirectory, "script.txt"]}, Export[file, script, "String"]; AppleScript["RunFile", file]] ...


5

This imports a whole sheet: Grid[#, Dividers -> All] &@ Import["http://joliclic.free.fr/html/object-tag/en/data/test.sxc", {"Data", 1}] And this imports three contiguous rows and two non-contiguous columns: Grid[#, Dividers -> All] &@ Import["http://joliclic.free.fr/html/object-tag/en/data/test.sxc", {"Data", 1, Range[1, 3], ...


4

Notice that you can use Import["file.xlsx", {"Data",k,m,n}] to import data at cell {m,n} on k-th sheet in the file. To import a range of data, simply replace number m and n by a range list, e.g. Import["file.xlsx", {"Data",1,Table[i,{i,3,8}],{1,2}}] will import data from row 3 to 8, columes 1 and 2 from 1st sheet in your data file, giving you a 6*2 list. ...


3

Save your import result to a variable and check its structure. You will notice that importresult[[1]] is a List (representing the first row, the header in this case). Thus, if you use "" as the pattern for DeleteCases, it will match nothing because in level 1 of importresult there cannot be an empty string anywhere. You could tell DeleteCases to operate on ...


3

This is not a complete answer but has too much for a comment. I don't have Numbers so do not know what is in the file you linked but the following information can be obtained: Import["PathTo/example.numbers", "ZIP"] (* {"QuickLook/Thumbnail.jpg", "buildVersionHistory.plist", "index.xml"} *) Now grab the XML: Import["PathTo/example.numbers", ...


2

Assuming the XLS file is in this URL: url = "http://statlinks.oecdcode.org/982013061P1T001.XLS"; This gives you the list of sheets in the XLS file sheetslist = Import[url, {"XLS", "Sheets"}]; And you can Import the second sheet by Import[url, {"Sheets", sheetslist[[2]]}] Backtracking, now to get that URL... Get a list of links in the page: ...


2

Copying my answer from SuperUser: I am not familiar with the Excel clipboard format, but there is a lovely suite of tools for pasting tabular data in the form of a Palette. Open this page and scroll down to Pasting tabular data into notebooks. When you evaluate that block of code, you will get a Palette with three buttons for different formats. I think ...



Only top voted, non community-wiki answers of a minimum length are eligible