# Help me with an ampl error!

**URL:** https://discuss.ampl.com/t/help-me-with-an-ampl-error/1076
**Category:** Support
**Tags:** errors-and-messages
**Created:** [April 28, 2024, 11:56am UTC](https://discuss.ampl.com/t/help-me-with-an-ampl-error/1076 "2024-04-28T11:56:34Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![fatima](https://avatars.discourse-cdn.com/v4/letter/f/f17d59/32.png) [@fatima](https://discuss.ampl.com/u/fatima)
#### Post date: [April 28, 2024, 11:56am UTC](https://discuss.ampl.com/t/help-me-with-an-ampl-error/1076/1 "2024-04-28T11:56:34Z")

</div>

i have a problem in the dat file , I cant find the proper code or way to read a table from excel to AMPL. the files are shown below.

 ![‏‏لقطة الشاشة (1726)](https://us1.discourse-cdn.com/flex019/uploads/ampl/original/1X/314cd54c108922d2395734d9beb99c7110d1dd6a.png)

[project.xlsx](https://discuss.ampl.com/uploads/short-url/t5eKrfDdtC9TMfkA6m3KSS9QUr7.xlsx) (70.5 KB)  
[sec.mod](https://discuss.ampl.com/uploads/short-url/3JQPok3NLhWWQPS49Fx4hx1m3Aq.mod) (393 Bytes)  
[sec.dat](https://discuss.ampl.com/uploads/short-url/447o8HIMxV6pplYio5mTm2hwxP9.dat) (318 Bytes)

---

<div class="post-metadata">

### Author: ![4er](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/4er/32/530_2.png) [@4er](https://discuss.ampl.com/u/4er)
#### Post date: [April 28, 2024, 9:00pm UTC](https://discuss.ampl.com/t/help-me-with-an-ampl-error/1076/2 "2024-04-28T21:00:04Z")

</div>

Your file

```auto
"C: \path\file.project.xlsx"

```

cannot be found, because there is an extra space in its name. You will need to fix all of the table statements to remove this space, so that the file is specified as

```auto
"C:\path\file.project.xlsx"

```

Also note the following:

- In `sec.dat`, you will need to write `data;` before `param` `B :=` `10000;` — so that AMPL knows you will be reading some data statements. (Otherwise, you will get a “B is already defined” error.)

- We now recommend using our [Direct Spreadsheet Interface](https://plugins.ampl.com/amplxl.html) — rather than the older “ODBC” interface, which can be much harder to set up.

---

<div class="post-metadata">

### Author: ![marcos](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/marcos/32/154_2.png) [@marcos](https://discuss.ampl.com/u/marcos)
#### Post date: [April 29, 2024, 11:09pm UTC](https://discuss.ampl.com/t/help-me-with-an-ampl-error/1076/3 "2024-04-29T23:09:10Z")

</div>

Hi Fatima,

In addition to what Bob suggested, you can also use the Python API to send data to ampl. This is an example of reading data from a google sheet (you could do the same with an excel’s).

> **[Google Colaboratory](https://colab.research.google.com/github/ampl/colab.ampl.com/blob/master/authors/fdabrandao/gspread/gspread.ipynb)**

I find Python more suitable to send data to ampl, the api makes it much easier.
