stvbll / google-sheets-solaredge

Collection of Google Sheets scripts for interacting with SolarEdge API
Apache License 2.0
36 stars 6 forks source link

Cannot call method "getRange" of null #3

Open tethyso opened 7 years ago

tethyso commented 7 years ago

Hi there, i've tried to follow the easy guide, but I'm stuck with this error when I try to run overview.gs, and I'm only left with an empty sheet (only details got somehow populated with some data).

If I try to run the overview.gs, i get that error on lines 44 and 45

sheetDashboard.getRange("B1").setValue(lifeTimeData); //write lifetime data, in MWh, to dashboard sheet

sheetDashboard.getRange("D1").setValue(lastYearData); //write last year data, in kWh, to dashboard sheet

any hints?

SuperJakish commented 6 years ago

I'm not sure exactly what the issue is, but I started by trying to build my own sheet and adding the code to it. That was a mistake - I got the same errors you did. When I copied the example sheet over to my drive and put in my Site ID, API Key, and Inverter Serial it worked just fine.

SuperJakish commented 6 years ago

After learning a bit more about how this works, it looks like the above error happens when the cells you're trying to paste into don't exist. Make sure there are enough destination cells to paste all of your data and you should be good.