ryan-d-williams / MMM-GoogleSheets

Google Sheets Module for MagicMirror
MIT License
27 stars 2 forks source link

script do not start #33

Closed 1Cedric1 closed 1 month ago

1Cedric1 commented 3 months ago

dear @ryan-d-williams thank you for having the possibility to use your interesting module.

I stucked with an error, maybe you could give me an advise ?

thank you for your interest and you help !

Kind regards,

Cédric

step 1 OK : my spreadsheet on Google drive Capture d’écran 2024-07-06 à 13 44 02

step 2 OK : adding the library Capture d’écran 2024-07-06 à 13 44 56

step 3 OK : update the code Capture d’écran 2024-07-06 à 13 45 30

step 4 OK : deployment Capture d’écran 2024-07-06 à 13 46 24

step 5 not OK, by clicking on the URL Capture d’écran 2024-07-06 à 13 46 37

step 6 not OK, by running the code, clicking on button "run". Capture d’écran 2024-07-06 à 13 46 56

step 7 : detail on appscript Capture d’écran 2024-07-06 à 13 47 26

omadab commented 2 months ago

I have this same error! It doesnt seem that MMM-GoogleSheets even runs when i start magic mirror!

ryan-d-williams commented 2 months ago

@1Cedric1 clicking on the link directly is not expected to work. The module injects parameters into the url to be able to read data from the sheet. Check out these issues below for similar issues: https://github.com/ryan-d-williams/MMM-GoogleSheets/issues/2 https://github.com/ryan-d-williams/MMM-GoogleSheets/issues/7 https://github.com/ryan-d-williams/MMM-GoogleSheets/issues/29

If you want to test the URL directly, you need to inject the URL parameters. Something like "?sheet=Sheet1&range=A1:B10" added to the end of the URL should work. Make sure to replace it with the correct sheet name and range.

Feel free to post your actual script url (if your google sheets data is not sensitive) and your config file if you want help debugging.

ryan-d-williams commented 2 months ago

@omadab What error are you seeing? Feel free to post your actual script url (if your google sheets data is not sensitive) and your config file if you want help debugging.

omadab commented 2 months ago

@omadab What error are you seeing? Feel free to post your actual script url (if your google sheets data is not sensitive) and your config file if you want help debugging.

@ryan-d-williams I will open a seperate ticket

smey1 commented 1 month ago

I have exactly the same problem. is there a solution? Thanks for your help.

omadab commented 1 month ago

https://github.com/ryan-d-williams/MMM-GoogleSheets/issues/34

ryan-d-williams commented 1 month ago

@smey1 have you read the links in my previous comment or the link in @omadab's comment? The link on it's own is not expected to work. If you post your config we can try to help out.

smey1 commented 1 month ago

Hello, thanks for your reply! The MM log says: [04.08.2024 16:23.15.845] [ERROR] Whoops! There was an uncaught exception... [04.08.2024 16:23.15.847] [ERROR] SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON at JSON.parse (<anonymous>) at Request._callback (/home/pi/MagicMirror/modules/MMM-GoogleSheets/node_helper.js:47:27) at self.callback (/home/pi/MagicMirror/modules/MMM-GoogleSheets/node_modules/request/request.js:185:22) at Request.emit (node:events:513:28) at Request.<anonymous> (/home/pi/MagicMirror/modules/MMM-GoogleSheets/node_modules/request/request.js:1154:10) at Request.emit (node:events:513:28) at IncomingMessage.<anonymous> (/home/pi/MagicMirror/modules/MMM-GoogleSheets/node_modules/request/request.js:1076:12) at Object.onceWrapper (node:events:627:28) at IncomingMessage.emit (node:events:525:35) at endReadableNT (node:internal/streams/readable:1358:12)

here is my config: [REDACTED]

here a screenshot from the Google Apps Script:

Bildschirmfoto 2024-08-08 um 12 03 40
ryan-d-williams commented 1 month ago

@smey1 if you try the full link (https://script.google.com/macros/s/AKfycbye9hXJwyrngb8u7oIdTE9BM5CFxBJPGCvqgRk6mYuPCantQwXRBQBzq25151w3we0nPg/exec?sheet=Inventar&range=A1:B20) you'll see it can't find the sheet name. Are you sure you're spreadsheet has a sheet name called "Inventar"? Note that this is not the name of the document which is found in the upper left corner. This is the name of the sheet that is on the bottom row of the page.

I edited your comment to redact the config. You included your API keys for other modules which is a bad idea on a public post.

ryan-d-williams commented 1 month ago

@smey1 EDIT: I looked into this a bit more and it looks like the problem is there is no "active spreadsheet". Are you sure you attached the google apps script code to an existing spreadsheet?

ryan-d-williams commented 1 month ago

@smey1 I pushed a new README today with updated instructions with pictures. I recommend you follow those new instructions to ensure everything is set up correctly. If you are still having issues feel free to reopen this issue or open a new one.