jamietr1 / google-docs-writing-tracker

Automation scripts to track writing in Google Docs
187 stars 39 forks source link

Range not found (line 373, file "Code") #18

Open DrWhodini opened 9 years ago

DrWhodini commented 9 years ago

Firstly - For someone who advertises 'lack of' support, it's great to see you replying to our niggles and problems. Secondly - I'm loving these scripts, they are great motivational tools that make a difference to how I write. Lastly - The error - Installation was pretty straightforward, although I needed to totally quite drive and log back in for the stats to work. The Almanac, however repeatedly comes up with this the same error - Range not found (line 373, file "Code")

370 function getNamedRangeCellValue(strRangeName) 371 { 372 var ss = SpreadsheetApp.openById(QS_WRITING); 373 if (ss.getRangeByName(strRangeName) != null) 374 return ss.getRangeByName(strRangeName).getValues()[0]; 375 else 376 return null; 377 }

I'm no coder, but I can sometimes get a feel where an issue may lie. Here, however, I'm lost.

Thanks

OthelloPrime commented 9 years ago

Dr. Whodini (love the name, btw) have you attempted any further troubleshooting on your error? I re-installed the scripts in an attempt to correct an error I was having. My error went away but now I get the exact error you do.

Thanks.

jamietr1 commented 9 years ago

The most common reason I've seen for this error is that someone goes in an manually changes the value in cell B1 or B2 on the data tab in order to put in their current streak. But you can't overwrite those values because they are calculated and if you overwrite them, you'll break the scripts.

OthelloPrime commented 9 years ago

I started over without my previous data. (I preserved it in another spreadsheet.) The only number that exists is the goose egg created when I manually ran the WritingStats script earlier.

OthelloPrime commented 9 years ago

LOL, well I fixed this issue by switching to the Beta track. Now, I get a different error. I'll post the error and any comments there so I don't hijack this thread. Thanks Jamie!

rustuptwist commented 9 years ago

I had trashed all my scripts files and started over from scratch and I got this same error as well. I as getting both a writingstats and Daily Almanac error each day. Now just this has appeared. When I run the 'run' button in the script it also gives this error. I logged out of my gmail account and logged back in to see if that would change anything. It did not. Any ideas?

coes123 commented 9 years ago

I am having the exact same problem on a fresh install :( Not sure where to even begin.

coes123 commented 9 years ago

Guys I found the way to fix this!! All I did was check the Execution Transcript after each error to realize the problem was that the cell names need to be assigned on the Records sheet. Here, I'll explain:

All you have to do is assign names to cells B3, C3, D3 and E3 as follows:

B3: RecordWritingDate C3: RecordWritingWords D3: RecordWritingStreak E3: RecordWritingGoalStreak

Do this and run the getAlmanacText trigger and you are done. Mine is finally working! Good luck.

1

2

coes123 commented 9 years ago

Ok new issue. Both scripts are running well and sending the email to Evernote BUT DailyAlmanac is not counting the words. I'm getting a "You wrote a total of NaN words." Here's a screenshot. I'll keep poking around.

I already tried test and non test modes.

image

jamietr1 commented 9 years ago

Question on this: were you using the version of the spreadsheet that I shared (the one listed in the readme) or was this an earlier version of your own spreadsheet? I thought I'd included the names in the shared version, but version of the spreadsheet prior to the shared version might help explain why the cells are not named. When I have time, I could add some initialization code that does a kind of validation check on the spreadsheet and adds anything it finds missing.

Good catch!


Jamie Todd Rubin (@jamietr http://twitter.com/jamietr) http://www.jamietoddrubin.com http://www.jamietoddrubin.com/going-paperless/

On Mon, Sep 15, 2014 at 12:34 PM, coes123 notifications@github.com wrote:

Guys I found the way to fix this!! All I did was check the Execution Transcript after each error to realize the problem was that the cell names need to be assigned on the Records sheet. Here, I'll explain:

All you have to do is assign names to cells B3, C3, D3 and E3 as follows:

B3: RecordWritingDate C3: RecordWritingWords D3: RecordWritingStreak E3: RecordWritingGoalStreak

Do this and run the getAlmanacText trigger and you are done. Mine is finally working! Good luck.

[image: 1] https://cloud.githubusercontent.com/assets/8754843/4274679/d5891ac8-3cf5-11e4-968e-6a901e57d69c.PNG

— Reply to this email directly or view it on GitHub https://github.com/jamietr1/google-docs-writing-tracker/issues/18#issuecomment-55617764 .

coes123 commented 9 years ago

I'm sorry, I can't find that Shared Spreadsheet you mention on any readme :( I'll keep looking. Thank you.

jamietr1 commented 9 years ago

It should be listed in the readme in the beta-version-2 branch.


Jamie Todd Rubin (@jamietr http://twitter.com/jamietr) http://www.jamietoddrubin.com http://www.jamietoddrubin.com/going-paperless/

On Mon, Sep 15, 2014 at 1:02 PM, coes123 notifications@github.com wrote:

I'm sorry, I can't find that Shared Spreadsheet you mention on any readme :( I'll keep looking. Thank you.

— Reply to this email directly or view it on GitHub https://github.com/jamietr1/google-docs-writing-tracker/issues/18#issuecomment-55622236 .

coes123 commented 9 years ago

Hi,

I found your shared spreadsheet file but I ran into a new error.

Cannot find method formatDate(string,string,string). (line 359, file "Code")

I checked issue #16 and followed the instructions, such as making sure both scripts and the spreadsheet had the same time zone (I am in CDT). I tried EST and CDT to no avail. I also made sure the spreadsheet wasn't in Test Mode and I added the sandbox folders... I am lost now.

I'll keep trying :(

Btw, I changed the timezone in DailyAlmanac in lines 25, 231 and 359.

359 var curDate = Utilities.formatDate(data[i][j], "EDT", "MM/dd/yyyy");

Oh and I also changed the spreadsheet ID on both scripts.

coes123 commented 9 years ago

What's curious is this. If I switch the DailyAlmanac script to my original spreadsheet the Script runs well but it emails me the NaN (not a number) error. What's also interesting is that my original spreadsheet is in a different time zone setting than the scripts. This, in my opinion, rules out the problem being the time zones. If has something to do with the cells.

I tried removing number formatting on everything too, just in case. I got nothing...