ryan-d-williams / MMM-GoogleSheets

Google Sheets Module for MagicMirror
23 stars 2 forks source link

Auto range? #25

Open retroflex opened 1 year ago

retroflex commented 1 year ago

Nice module! Is there any way to automatically set the range (e.g. A1:B6) to include all non-empty cells in the sheet? In case I want to show a sheet that varies in nr of rows for example.

ryan-d-williams commented 1 year ago

@retroflex

You can't currently do this with the module directly, but you can accomplish this by creating a new sheet that does the filtering for you, and then you can import that sheet into the module.

What is the use case if you don't mind me asking? If it something that a lot of people will use I can add it in a future version.

retroflex commented 1 year ago

My use case is I use a sheet for my kids' weekly recurring activities for the family to keep up with everyday life. My partner wants to add different stuff to this, like comments (more rows) or more activites (more columns) easily. Not a big deal, just would be a nice feature.

brandonfake69 commented 10 months ago

Would love this!

There is getDataRange() in Apps Script that could accomplish this. Let the user pass in 'auto' (or something like that) for the range and then in code.gs if range is 'auto' then call getDataRange() instead of getRange(). This would be a simple way to not break existing users that are calling a fixed range.

https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet#getdatarange