Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I'm trying to import a list from my Gmail into a spreadsheet.
It has worked flawlessly several times, but I decided to do some cosmetic changes and now I get a baffling error:
var l = artikelen.length; //l = 40 in this case
var importSh = SpreadsheetApp.getActive().getSheetByName("import");
var range = importSh.getRange(2,1,l,1);
range.setBackground("#ab6e6e");
SpreadsheetApp.flush(); //throws error 'Input exceeds the limit of 50000 characters in a cel'
What is that? I'm not trying to put anything in a cell?? I'm just ordering to pick a range and set a colour AFAIK. Which in fact is not executed either...
What am I overlooking here?
Any suggestion will be welcome.
The culprit may be elsewhere in your code. Chances are that there is an attempt to put more than 50,000 characters in some cell.
Spreadsheet writes are lazy, and the error may only get shown when the script terminates, or at flush(), as the case seems to be here. To debug, add a flush() after every Range.setValues() and Range.setValue() call. Use console.log() to find what the values you are writing look like.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I'm new to Octave and I've a script that work in matlab that have following structure :
function []=myFunctionName()
...
a='path';
b=2;
c=5
d='x';
[x,y]=lecFunc(a,b,c,d);
plot(x,y);
...
function [k,t]=lecFunc(pt, nF, nS, val)
....
fid=fopen(pt,'r');
k=fread(fid,[1,N],'real*4');fclose(fid);
t=linspace(tmin,tmax,nt);
etc ...
And I get the error :
error: 'lecFunc' undefined near line 141 column 10
I couldn't understand why... I try to seprate the functions with endfunction and also put the function lecFunc at the top, but it still not work...
Could someone help me to understand this difference between matlab and octave ?
Thanks a lot !
You use lecFunc in myFunctionName. Try to define lecFunc before defining myFunctionName
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
invalid command name "if{0}{"
Giving me an error, for that I have find how many cell in the file.
Where am I making a mistake?
Update::::::::::::::::::::::::::::::::::::::::::::::::::::::::
I am having an issue while sorting an array...
It says
enter image description here
Since the last element is integer, still it says "expected integer but got...
Where am i making mistake?
You must place a space between 'if' and the opening brace.
Basicly, the Tcl interpreter tokenizes commands by searching for whitespace, while at the same time substituting stuff inside []. So first, the regexpr is evaluated, yieling 0 and togehter with the remaining characters this yields the command name.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have to write a function that produces random(parameter) integers i have to write random output of this funtion into .txt file. Also i have to find max and min integers from this function (write them into .txt too)
I cant find any tutorial about this subject. Want to use "a+" as writer.
Firstly, please have a look online for tutorials on how to write to a file. There are loads of free resources online.
You have already done a lot of the work and only needed few more lines
import random
def createRandomNumberFile(min, max, count, outputFileName):
outputFile = open(outputFileName, 'a+')
for item in range(0, count):
randomNumber = random.randint(min,max)
outputFile.write(randomNumber)
outputFile.close
Explanation - As you have assigned the file using the 'a+' mode (appending mode) to a variable (outputFile) you can simply use this variable to write to the file and then later close file (closing the file isn't always necessary but is good practice).
Hope that helps
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
# testing entry of multiple numbers into a list.
from collections import Counter
s = raw_input("Please enter your numbers: ")
numbers = map(int, s.split())
print 'this is what you entered'
print "how many entries? ", len(numbers)
mean = sum(numbers)/len(numbers)
print 'and the Mean is', mean
mode = Counter(numbers)
print 'and the Mode is', mode.most_common(1)
def median(numbers):
numbers.sort()
if len(numbers)%2 == 1:
return numbers[len(numbers)/2]
else:
return (numbers[len(numbers)/2]+numbers[len(numbers)/2 -1])/2.0
print 'and the Median is', median
I assume the 'strange output' you mention is the last line of output when you run your code:
and the Median is <function median at 0x0256D9B0>
(You may get a slightly different number.)
The reason is fairly simple. You're not calling the median function, you're just printing it.
I think you want to replace the last line of your program with
print 'and the Median is', median(numbers)
Windows error or your Python coding? Your Python coding, without a shadow of a doubt.
I want to write this into the range B1..
=split(A1," ")
(the delimiter is a space)
How do I do it using code?
I tried this...
var splitCell = "=SPLIT(A1," ")";
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1").getRange("B1").setFormula(splitCell);
But the quotes are obviously ruinous. Therefore how are quotes handled in such instances?
EDIT
Sorry. Brain-fart.
var splitCell = '=SPLIT(A8," ")';
I thought that I had already tried that (about a million times) but when I just tried it (again) it worked no problem.
Thanks anyway
(I'm sure I'll be back with less smelly questions in the future)
At the time that I asked my question, I was not allowed to answer my own question (newbies here have limitations). However the answer to my question was stated in the "edited" part of my question.
I apologize for the confusion, but at the time I had no other options available to me, so therefore my question remained "Unanswered" even though I already resolved it.
Anyway, the answer is:
var splitCell = '=SPLIT(A8," ")';