# \[App\]\[Pro\] Homey Easy Logger

**URL:** <https://community.homey.app/t/app-pro-homey-easy-logger/76021>\
**Category:** Apps\
**Tags:** tools\
**Created:** [February 4, 2023, 9:22pm UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021 "2023-02-04T21:22:25Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![bwa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bwa/32/17852_2.png) [@bwa](https://community.homey.app/u/bwa)\
**Post date:** [February 23, 2023, 12:22pm UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/21 "2023-02-23T12:22:42Z")

</div>

Let me see what I can do here.

---

<div class="post-metadata">

**Author:** ![bwa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bwa/32/17852_2.png) [@bwa](https://community.homey.app/u/bwa)\
**Post date:** [February 23, 2023, 12:29pm UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/22 "2023-02-23T12:29:45Z")

</div>

@DirkG I assume you know that the setCell card is very easy use. Month-nr would resolve column, the day-nbr in month would address the row. So a very simple formula would produce exact what cell to set based on the date

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [February 23, 2023, 12:36pm UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/23 "2023-02-23T12:36:29Z")

</div>

But then I would have to create a separate setCell card for each individual cell, right?

---

<div class="post-metadata">

**Author:** ![bwa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bwa/32/17852_2.png) [@bwa](https://community.homey.app/u/bwa)\
**Post date:** [February 23, 2023, 1:02pm UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/24 "2023-02-23T13:02:29Z")

</div>

Not at all.

This simple script will create the cell you need:

let date = new Date();  
let sheet = ‘Ark 8’;

// 65 = ‘A’

let column = String.fromCharCode(65 + date.getMonth()+1);  
let day = date.getDate();

let cellNbr = sheet + “!”+ column + day;

return cellNbr;

Put it into the flow with Homey Script, and you are done

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/a/5acff7e45212f98e1ecd12bc1b06cf8825c97035.png)

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [February 23, 2023, 2:17pm UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/25 "2023-02-23T14:17:23Z")

</div>

The problem I have with scripts is, that I don’t have absolutely no script skills. So I’m not able to adjust or repair such a script and I’m dependent on other users.  
Even with this small script, I’m already overwhelmed and don’t know which parts to replace, sorry.

---

<div class="post-metadata">

**Author:** ![bwa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bwa/32/17852_2.png) [@bwa](https://community.homey.app/u/bwa)\
**Post date:** [February 24, 2023, 1:25pm UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/26 "2023-02-24T13:25:35Z")

</div>

It shouldn’t really be very hard.

I have created a page with very simple and described code here : [calculateCellforDate.js - Homey Easy Logger - Confluence](https://wiki.bwa.no/display/HEL/calculateCellforDate.js)

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [February 24, 2023, 1:51pm UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/27 "2023-02-24T13:51:22Z")

</div>

Thank you for your support. With the code on the linked page I managed to use the script. However, the value is inserted in the wrong place within the table:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/a/7a5703b52616030fc7ca71d51f8c9e499735eb2b.png)

These are the data that I have used:

```auto
let sheetName = '2023';
let startingColumnChar = 'B';
let startingRowNbr = 2;

```

Is there a mistake?

---

<div class="post-metadata">

**Author:** ![bwa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bwa/32/17852_2.png) [@bwa](https://community.homey.app/u/bwa)\
**Post date:** [February 24, 2023, 4:02pm UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/28 "2023-02-24T16:02:33Z")

</div>

Yes, a mistake. Done by me. Was a little quick at work to reach my train to home. Try the updated code from [calculateCellforDate.js - Homey Easy Logger - Confluence](https://wiki.bwa.no/display/HEL/calculateCellforDate.js)

I think that will do. Tested with your input

---

<div class="post-metadata">

**Author:** ![bwa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bwa/32/17852_2.png) [@bwa](https://community.homey.app/u/bwa)\
**Post date:** [February 24, 2023, 4:17pm UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/29 "2023-02-24T16:17:02Z")

</div>

@DirkG And in your case you can use this line

let sheetName = ‘’ + timeOfJustNow.getFullYear();

and this script will work forever 😁

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [February 24, 2023, 5:25pm UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/30 "2023-02-24T17:25:06Z")

</div>

No problem, and no hurry!  
It’s getting better, but not quite correct yet… 😉

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/2/e2ad729ee8c50baf88d85a4d4e5b18f77dd38666.png)

Now that I know where the first mistake was, I updated the code myself:

```auto
let dayInMonth = timeOfJustNow.getDate()-1;

```

And yes, it works. But will it work also at the first day of a month? And what is exactly the problem? Maybe the timezone of the file? The time zone for Germany (GMT + 01:00) is set.

> [@bwa](#):
>
> let sheetName = ‘’ + timeOfJustNow.getFullYear();

How is this supposed to work? Do I need to create a file with multiple spreadsheets named by year?  
Like this?  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/2/8243ba5c60a1953612e6d1ef5b8ac61404a42098.png)

---

<div class="post-metadata">

**Author:** ![bwa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bwa/32/17852_2.png) [@bwa](https://community.homey.app/u/bwa)\
**Post date:** [February 24, 2023, 5:45pm UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/31 "2023-02-24T17:45:13Z")

</div>

The 2024 is not needed before we get to next year, but even then, the script does not need to be changed. Just be shure to create the 2024 sheet before 1.1.2024 …

Often you need to add or subtract 1 when handling dates. Some field starts on 0 other on 1. Just try to add or subtract 1.

---

<div class="post-metadata">

**Author:** ![bwa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bwa/32/17852_2.png) [@bwa](https://community.homey.app/u/bwa)\
**Post date:** [February 24, 2023, 5:47pm UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/32 "2023-02-24T17:47:04Z")

</div>

Regarding timezones, yes, it migth be important if your script is running just a few minutes past midnight. I will provide a test for you later.

---

<div class="post-metadata">

**Author:** ![bwa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bwa/32/17852_2.png) [@bwa](https://community.homey.app/u/bwa)\
**Post date:** [February 25, 2023, 5:32pm UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/33 "2023-02-25T17:32:20Z")

</div>

@DirkG I have updated the homepage with som additions you can use to verify that time is absolutely correct. Just copy it into a homey script and execute.

[https://wiki.bwa.no/display/HEL/calculateCellforDate.js](https://wiki.bwa.no/display/HEL/calculateCellforDate.js)

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [February 26, 2023, 11:07am UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/34 "2023-02-26T11:07:07Z")

</div>

I have absolutely no idea what the script does, but it works.  
Thanks a lot!

**Edit**  
@bwa, the shift to the new month also worked flawlessly.  
Thank you very much!

Cheers 🍻

---

<div class="post-metadata">

**Author:** ![bwa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bwa/32/17852_2.png) [@bwa](https://community.homey.app/u/bwa)\
**Post date:** [March 5, 2023, 12:39pm UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/35 "2023-03-05T12:39:34Z")

</div>

@DirkG Niice… Looks like 2024 is already ready 🙂 As long as you update the sheet name of a year exists it will produce forever

If you change the sheetName line to this :

let sheetName = ‘something-’ + timeOfJustNow.getFullYear();

You will get a more usable tab name in the sheet, it’s more easy to add different content in same spreadsheet as a tab name of ‘2023’ doesn’t tell so much

A sample here :

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/4/84df77bae053c88875a96c6bb08f3e1a07879090.png)

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [March 16, 2023, 11:08am UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/36 "2023-03-16T11:08:00Z")

</div>

I will update the sheet name, it’s the easiest und understandable way for me to do this.  
Because I have absolutely no clue what…

```auto
let sheetName = ‘something-’ + timeOfJustNow.getFullYear();

```

does and how to use it.

Homey script and all the other programming languages are black boxes for me. That’s the reason why I want to keep it as simple as possible.

---

<div class="post-metadata">

**Author:** ![bwa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bwa/32/17852_2.png) [@bwa](https://community.homey.app/u/bwa)\
**Post date:** [March 16, 2023, 11:19am UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/37 "2023-03-16T11:19:09Z")

</div>

This line of code will put a prefix your sheetname with the text you put instead of something.

What I could see is that you created a sheet with name of ‘2023’. This is very general, so if you would like to have a more descriptive sheet(tab)name, such as MyCost-2023 for this year and MyCost-2024 for next year, then you would change the line to

**let sheetName = ‘MyCost-’ + timeOfJustNow.getFullYear();**

Then you must of cource rename the current sheet tab name from 2023 til MyCost-2023 (or whatever you call it )

And if you are perfectly good with 2023 as the sheet(tab)name , just use

**let sheetName = timeOfJustNow.getFullYear();**

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [March 16, 2023, 11:23am UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/38 "2023-03-16T11:23:12Z")

</div>

Ah, ok, now I understand. But I’m perfectly good with 2023 as sheet name. Thx!

---

<div class="post-metadata">

**Author:** ![bwa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bwa/32/17852_2.png) [@bwa](https://community.homey.app/u/bwa)\
**Post date:** [March 26, 2023, 9:07am UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/39 "2023-03-26T09:07:44Z")

</div>

Note that due to daylight time savings, the time might be wrong with one hour, it’s corrected in v1.6.1

---

<div class="post-metadata">

**Author:** ![bwa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bwa/32/17852_2.png) [@bwa](https://community.homey.app/u/bwa)\
**Post date:** [March 26, 2023, 1:31pm UTC](https://community.homey.app/t/app-pro-homey-easy-logger/76021/40 "2023-03-26T13:31:10Z")

</div>

Testers needed for v1.7.0

It should handle timezones and summertime/daylight changes better. Especially users from other timezones than Oslo, should be nice to get it verified. It’s only out in test ([Easy Logger | Homey](https://homey.app/no-no/app/no.bwa.easy-logger/Easy-Logger/test/)) so it must be installed by purpose

[Previous page](https://community.homey.app/t/app-pro-homey-easy-logger/76021.md?page=1)

[Next page](https://community.homey.app/t/app-pro-homey-easy-logger/76021.md?page=3)
