# Saving live information to excel file every half hour

**URL:** <https://discourse.processing.org/t/saving-live-information-to-excel-file-every-half-hour/43061>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [October 25, 2023, 7:47pm UTC](https://discourse.processing.org/t/saving-live-information-to-excel-file-every-half-hour/43061 "2023-10-25T19:47:01Z")\
**Posts on this page:** 1\
**Showing post:** 44

<div class="post-metadata">

**Author:** ![RichardDL](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@RichardDL](https://discourse.processing.org/u/RichardDL)\
**Post date:** [November 7, 2023, 7:14pm UTC](https://discourse.processing.org/t/saving-live-information-to-excel-file-every-half-hour/43061/44 "2023-11-07T19:14:09Z")

</div>

Yes. Make a string with the machine names. At the top of the prog, with your other variables.

`String machineNames = "Press 2a, Press 2b, ... ";`

We need to detect if the file exists. Have to do this after we know the name, and before we open it. Then after we’ve opened the file, if it didn’t exist, write the title line. I didn’t know how to check if a [file exists](https://discourse.processing.org/t/how-to-check-if-a-file-is-exist-in-data-folder-by-code/589) but @GoToLoop has done it. Put this after the other functions we added earlier.

```auto
boolean fileExists(String filename) {
  File f = dataFile(filename);
  String filePath = f.getPath();
  boolean exist = f.isFile();
  println(filePath, exist);
  return exist;
}

```

Put this after we made the filename with the date in it.

```auto
  boolean csvFileExists  
  csvFileExists = fileExists("@sketchPath + "/" + filename")

```

(that has to be the same filespec as in the open, we should rationalise that but never mind now.) After the open we need to conditionally write the new line.

```auto
  if (!csvFileExists) {
    output.write("DateTime," + machineNames);
  }

```

---

_[View the full topic](https://discourse.processing.org/t/saving-live-information-to-excel-file-every-half-hour/43061)._
