Dear All,
I failed when I tried to load excel data into Gauss, is there anyone can help me figure out the problem? Thanks a lot!
When I use:
xobs = xlsReadM("load_test_2.xlsx", "A2", 1, ""); or
new;
closeall ;
fname = "load_test_2.xlsx";
range = "A2:FI464016";
sheet = 1;
xobs = spreadSheetReadM(fname, range, sheet);
range = "FJ2:FJ464016";
sheet = 1;
yobs = spreadSheetReadM(fname, range, sheet);
The results show that:
Error in xlsReadM: Data read failed for some cells in file: load_test_2.xlsx [xls.src, line 132]
Currently active call:
File xls.src, line 133, in xlsReadM
end;
Traceback:
File xls.src, line 809, in spreadSheetReadM
mat = xlsreadm(file,range,sheet,vls);
On line 132 and 133, the codes are:
132: errorlogat "Error in xlsReadM: "$+retXlsErr(__convertXlsErrCode(err), file);
133: end;
3 Answers
0
1. Are you on Windows, Mac or Linux?
2. What version of GAUSS are you running?
3. See if this works?
x = seqa(1, 1.05, 5); ret = xlsWrite(x, "new_test.xls", "A1", 1, ""); new_x = xlsReadM("new_test.xls", "A1", 1, ""); print new_x;
0
Hi, thank you so much for your answer.
However, it is not work. It seems that this code generates a new excel data file but did not read my original excel data file.
If I use new_x = xlsReadM("new_test.xls", "A1", 1, ""); to read my dataset, it still shows that:
Error in xlsReadM: Data read failed for some cells in file: load_test_2.xlsx [xls.src, line 132]
Currently active call:
File xls.src, line 133, in xlsReadM
end;
Traceback:
By the way, I am using GAUSS 15 (*64) on Windows.
I have 464015 observations in my dataset and 170 variables. When I read 464015 observations and 35 variables, the code I used before can successfully read the dataset. However, when I real the whole dataset, it does not work. Is there Is there any other way I can try?
Thank you for the help!
Best.
0
Excel is great for some things, but it was not really designed to handle that much data. I think you will be happier to work with your data in a different format. For one thing, it will probably load 10-100 times faster.
I would recommend one of the following:
- Convert the file to CSV by opening it in Excel and exporting if that is possible.
- Read chunks of the data at a time in GAUSS and then write the data to a GAUSS dataset.
If you can read the data into GAUSS in two chunks, you could do something like this:
var_names = xlsReadSA("load_test_2.xlsx", "A1:FI1", 1, ""); xobs = xlsReadM("load_test_2.xlsx", "A2:FI232008", 1, ""); xobs = xobs | xlsReadM("load_test_2.xlsx", "A232009:FI464016", 1, ""); saved(xobs, "load_test_2.dat", var_names);
Your Answer
3 Answers
1. Are you on Windows, Mac or Linux?
2. What version of GAUSS are you running?
3. See if this works?
x = seqa(1, 1.05, 5); ret = xlsWrite(x, "new_test.xls", "A1", 1, ""); new_x = xlsReadM("new_test.xls", "A1", 1, ""); print new_x;
Hi, thank you so much for your answer.
However, it is not work. It seems that this code generates a new excel data file but did not read my original excel data file.
If I use new_x = xlsReadM("new_test.xls", "A1", 1, ""); to read my dataset, it still shows that:
Error in xlsReadM: Data read failed for some cells in file: load_test_2.xlsx [xls.src, line 132]
Currently active call:
File xls.src, line 133, in xlsReadM
end;
Traceback:
By the way, I am using GAUSS 15 (*64) on Windows.
I have 464015 observations in my dataset and 170 variables. When I read 464015 observations and 35 variables, the code I used before can successfully read the dataset. However, when I real the whole dataset, it does not work. Is there Is there any other way I can try?
Thank you for the help!
Best.
Excel is great for some things, but it was not really designed to handle that much data. I think you will be happier to work with your data in a different format. For one thing, it will probably load 10-100 times faster.
I would recommend one of the following:
- Convert the file to CSV by opening it in Excel and exporting if that is possible.
- Read chunks of the data at a time in GAUSS and then write the data to a GAUSS dataset.
If you can read the data into GAUSS in two chunks, you could do something like this:
var_names = xlsReadSA("load_test_2.xlsx", "A1:FI1", 1, ""); xobs = xlsReadM("load_test_2.xlsx", "A2:FI232008", 1, ""); xobs = xobs | xlsReadM("load_test_2.xlsx", "A232009:FI464016", 1, ""); saved(xobs, "load_test_2.dat", var_names);