Import XLS file

I would like to load a data excel file in Gauss 15 light (windows 64) but always return an error code. I tried with (as I saw in a post):

x = { 1.1, 2.2, 3.3, 4.4 };
xlsWriteM(x, "testfile.xls", "A1", 1, "");

To test the path but:

Error in xlsWriteM: Could not load file testfile.xls [xls.src, line 387]

Wich is the same error I get.

What can I do?

1 Answer



0



This error is probably caused because either:

  1. You do not have Excel installed in this computer.
  2. You do not have permissions to write to your GAUSS current working directory.
  3. There is a file named testfile.xls in your GAUSS current working directory that is not a proper Excel file.

If you do not have Excel installed on your computer

By default GAUSS for Windows reads Excel files by interacting with the version of Excel installed on your computer. GAUSS also has capabilities to read and write Excel files directly, rather than interacting with Excel. To tell GAUSS to read and write the files directly instead of using Excel, open the file GAUSSHOME/src/xls.src (GAUSSHOME is the location to which you installed GAUSS, by default it will be something like C:\gauss15lt). Around lines 38-40 you should see this:

#ifOS2WIN
   #define USECOMEXCEL 1
#endif

You need to comment out all three of these lines, so it looks like this, instead:

//#ifOS2WIN
//   #define USECOMEXCEL 1
//#endif

To resolve the other two problems

Change your GAUSS working directory to be your My Documents directory. You can change your GAUSS working directory by clicking the button with three dots [...] on the main GAUSS toolbar located just to the right of the dropdown that shows you current GAUSS path.

Once you are in a new directory that you know that you have permissions to write to, try the code snippet from your original post again.

aptech

1,773

Your Answer

1 Answer

0

This error is probably caused because either:

  1. You do not have Excel installed in this computer.
  2. You do not have permissions to write to your GAUSS current working directory.
  3. There is a file named testfile.xls in your GAUSS current working directory that is not a proper Excel file.

If you do not have Excel installed on your computer

By default GAUSS for Windows reads Excel files by interacting with the version of Excel installed on your computer. GAUSS also has capabilities to read and write Excel files directly, rather than interacting with Excel. To tell GAUSS to read and write the files directly instead of using Excel, open the file GAUSSHOME/src/xls.src (GAUSSHOME is the location to which you installed GAUSS, by default it will be something like C:\gauss15lt). Around lines 38-40 you should see this:

#ifOS2WIN
   #define USECOMEXCEL 1
#endif

You need to comment out all three of these lines, so it looks like this, instead:

//#ifOS2WIN
//   #define USECOMEXCEL 1
//#endif

To resolve the other two problems

Change your GAUSS working directory to be your My Documents directory. You can change your GAUSS working directory by clicking the button with three dots [...] on the main GAUSS toolbar located just to the right of the dropdown that shows you current GAUSS path.

Once you are in a new directory that you know that you have permissions to write to, try the code snippet from your original post again.


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.