Good day
I really nee help here, on how to import data from excel to Gauss. I have panel data of 46 country from 1980 to 2012 and 20 variables of each country
7 Answers
0
thank for the quick answer but i still can get it. when I type the following just to test,
fname = "test_data.xlsx";
range = "B2:E14";
sheet = 1;
test = spreadSheetReadM(fname, range, sheet);
it gave me an error meassage Error in xlsReadM: Could not load file test_data.xlsx [xls.src, line 132]
0
What is the return you get from entering:
filesa("*.xlsx");
0
here is it.
test = spreadSheetReadM(fname, range, sheet);
fname = "test_data.xlsx";
range = "B2:E14";
sheet = 1;
test = spreadSheetReadM(fname, range, sheet);
filesa("*.xlsx");
0
No, I mean what do you get if you enter:
filesa("*.xlsx");
at the GAUSS command prompt? The filesa function will list all files that match the pattern you specify (in this case, any file that ends with .xlsx) in your GAUSS current working directory. The return from the filesa command will rule out one possible problem. Also, which version of GAUSS do you have (i.e. version 15 for Mac or 14 for Windows 64-bit, etc?)
0
Dear
when I typed
filesa("*.xlsx");
I get this and nothing else
load_test.xlsx
please , I really need to understand how Gauss works. I am a phd student and it is my first time to use it. I have all the data available and the code, but I don't know how this sotware work.
regards
0
The problem is that this code below:
fname = "test_data.xlsx"; range = "B2:E14"; sheet = 1; test = spreadSheetReadM(fname, range, sheet);
is trying to load data from the file test_data.xlsx in your current GAUSS working directory. However, that file does not exist in your current GAUSS working directory. You need to change the fname input to the name and/or path of a file that exists on your system. For example, if you are on Windows and had a file named test.xlsx in your C:\gauss15\mydata directory, you could run this code:
fname = "C:\\gauss15\\mydata\\test_data.xlsx"; range = "B2:E14"; sheet = 1; test = spreadSheetReadM(fname, range, sheet);
If you were on Mac and a file named test_data.xlsx existed in /Users/YourName/, you could run this code:
fname = "/Users/YourName/test_data.xlsx"; range = "B2:E14"; sheet = 1; test = spreadSheetReadM(fname, range, sheet);
But if the file does not exist, or is in a different directory, then GAUSS will not be able to load it, until you give GAUSS the correct location for the file.
Since it appears (from the filesa statement you posted) that you do have a file named load_test.xlsx, you should be able to run this code successfully:
fname = "load_test.xlsx"; range = "A1"; sheet = 1; test = spreadSheetReadM(fname, range, sheet);
to try out.
Your Answer
7 Answers
thank for the quick answer but i still can get it. when I type the following just to test,
fname = "test_data.xlsx";
range = "B2:E14";
sheet = 1;
test = spreadSheetReadM(fname, range, sheet);
it gave me an error meassage Error in xlsReadM: Could not load file test_data.xlsx [xls.src, line 132]
What is the return you get from entering:
filesa("*.xlsx");
here is it.
test = spreadSheetReadM(fname, range, sheet);
fname = "test_data.xlsx";
range = "B2:E14";
sheet = 1;
test = spreadSheetReadM(fname, range, sheet);
filesa("*.xlsx");
No, I mean what do you get if you enter:
filesa("*.xlsx");
at the GAUSS command prompt? The filesa function will list all files that match the pattern you specify (in this case, any file that ends with .xlsx) in your GAUSS current working directory. The return from the filesa command will rule out one possible problem. Also, which version of GAUSS do you have (i.e. version 15 for Mac or 14 for Windows 64-bit, etc?)
Dear
when I typed
filesa("*.xlsx");
I get this and nothing else
load_test.xlsx
please , I really need to understand how Gauss works. I am a phd student and it is my first time to use it. I have all the data available and the code, but I don't know how this sotware work.
regards
The problem is that this code below:
fname = "test_data.xlsx"; range = "B2:E14"; sheet = 1; test = spreadSheetReadM(fname, range, sheet);
is trying to load data from the file test_data.xlsx in your current GAUSS working directory. However, that file does not exist in your current GAUSS working directory. You need to change the fname input to the name and/or path of a file that exists on your system. For example, if you are on Windows and had a file named test.xlsx in your C:\gauss15\mydata directory, you could run this code:
fname = "C:\\gauss15\\mydata\\test_data.xlsx"; range = "B2:E14"; sheet = 1; test = spreadSheetReadM(fname, range, sheet);
If you were on Mac and a file named test_data.xlsx existed in /Users/YourName/, you could run this code:
fname = "/Users/YourName/test_data.xlsx"; range = "B2:E14"; sheet = 1; test = spreadSheetReadM(fname, range, sheet);
But if the file does not exist, or is in a different directory, then GAUSS will not be able to load it, until you give GAUSS the correct location for the file.
Since it appears (from the filesa statement you posted) that you do have a file named load_test.xlsx, you should be able to run this code successfully:
fname = "load_test.xlsx"; range = "A1"; sheet = 1; test = spreadSheetReadM(fname, range, sheet);
to try out.