Invalid cell coordinate phpExcel - cell

I have tested that if using vlookup to search in the self sheet "=vlookup(h2, A2:B2000, 2, False)" and returning value from other sheet "=SupplierList!A2" and "=vlookup(SupplierList!H3, A2:B2000, 2, False)" are also fine.
so why only "=vlookup(h3, SupplierList!A2:B2000, 2, False)" drives into error?
--------------------------- ERROR MESSAGE -------------------------------
Fatal error: Uncaught exception 'Exception' with message 'PO!G2 -> Invalid cell coordinate A' in C:\Program Files\EasyPHP-5.3.6.0\www\ExcelImporter\Classes\PHPExcel\Cell.php:288 Stack trace: #0 C:\Program Files\EasyPHP-5.3.6.0\www\ExcelImporter\Classes\PHPExcel\Cell.php(204): PHPExcel_Cell->getCalculatedValue() #1 C:\Program Files\EasyPHP-5.3.6.0\www\ExcelImporter\Documentation\Examples\index.php(36): PHPExcel_Cell->getFormattedValue() #2 {main} thrown in C:\Program Files\EasyPHP-5.3.6.0\www\ExcelImporter\Classes\PHPExcel\Cell.php on line 288
--------------------------- ERROR MESSAGE -------------------------------
The Cell is with formula like this
**=IF(ISERROR(VLOOKUP(H2349,'Supplier List'!A:B,2,FALSE)),"-",VLOOKUP(H2349,'Supplier List'!A:B,2,FALSE))**

Too long to be a comment...
When debugging calculation errors, I use the following:
function testFormula($sheet,$cell) {
$formulaValue = $sheet->getCell($cell)->getValue();
echo '<b>'.$cell.' Value is </b>'.$formulaValue."<br />\n";
$expectedValue = $sheet->getCell($cell)->getOldCalculatedValue();
echo '<b>'.$cell.' Expected Value is </b>'.((!is_null($expectedValue)) ? $expectedValue : 'UNKNOWN')."<br />\n";
$calculate = false;
try {
$tokens = PHPExcel_Calculation::getInstance()->parseFormula($formulaValue,$sheet->getCell($cell));
echo '<b>Parser Stack :-</b><pre>';
print_r($tokens);
echo '</pre>';
$calculate = true;
} catch (Exception $e) {
echo "PARSER ERROR: ".$e->getMessage()."<br />\n";
echo '<b>Parser Stack :-</b><pre>';
print_r($tokens);
echo '</pre>';
}
if ($calculate) {
try {
$cellValue = $sheet->getCell($cell)->getCalculatedValue();
echo '<b>'.$cell.' Calculated Value is </b>'.$cellValue."<br />\n";
echo '<h3>Evaluation Log:</h3><pre>';
print_r(PHPExcel_Calculation::getInstance()->debugLog);
echo '</pre>';
} catch (Exception $e) {
echo "CALCULATION ENGINE ERROR: ".$e->getMessage()."<br />\n";
echo '<h3>Evaluation Log:</h3><pre>';
print_r(PHPExcel_Calculation::getInstance()->debugLog);
echo '</pre>';
}
}
}
$sheet = $objPHPExcel->getActiveSheet();
PHPExcel_Calculation::getInstance()->writeDebugLog = true;
testFormula($sheet,'A4');
This provides a fairly detailed log of everything that the calculation engine is doing, allowing the cause of the problem to be identified.
If you simply want to disable cell value calculation when saving a file, then you can issue the following command after instantiating yor writer, but before issuing the save command:
$objWriter->setPreCalculateFormulas(FALSE);

para resolver esse problema "Invalid cell coordinate" $this->caracteres = array(
' ', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'X', 'Y', 'W', 'Z',
'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM',
'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AX', 'AY', 'AW', 'AZ');
adicione mais caracteres ,
'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM',
'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AX', 'AY', 'AW', 'AZ'); ....
English
to solve this problem "Invalid cell coordinate" $ this-> characters = array (
             '', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L' , 'M',
             'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'X', 'Y', 'W', 'Z '
             'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM '
             'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AX', 'AY', 'AW', 'AZ ');
add more characters,
             'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM '
             'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AX', 'AY', 'AW', 'AZ '); ....

Related

C++: wchar_t cannot be stored in a std::map as a key or value

I am trying to make a variable with the data type std::map<char, wchar_t> in C++. When I try this, Visual Studio gives this build error:
C2440 'initializing': cannot convert from 'initializer list' to 'std::map<char,wchar_t,std::less<char>,std::allocator<std::pair<const char,wchar_t>>>'
The same error also occurs when wchar_t is the key data type and char is the value data type.
You can replicate this error by running the following code:
const std::map<char, wchar_t> UNICODE_MAP = {
{ 'X', L"█" },
{ 'G', L"▓" },
{ 'O', L"ᗣ" },
{ 'P', L"ᗤ" }
};
How would I make a map with the key as a char and the value as a wchar_t data type?
It's a map from narrow char to wide char, not char to wide string:
Instead of this:
const std::map<char, wchar_t> UNICODE_MAP = {
{ 'X', L"█" },
{ 'G', L"▓" },
{ 'O', L"ᗣ" },
{ 'P', L"ᗤ" }
};
Use this:
const std::map<char, wchar_t> UNICODE_MAP = {
{ 'X', L'█' },
{ 'G', L'▓' },
{ 'O', L'ᗣ' },
{ 'P', L'ᗤ' }
};
If you actually need the value to be a string, then declare it as:
const std::map<char, std::wstring> UNICODE_MAP = {
{ 'X', L"█" },
...
Also, while I'm here, I advocate for escaping all Unicode chars in source files that are not in the ASCII range. Between IDEs with varying behaviors, revision control systems, and the guy down the hall who didn't read your memo about "save as Unicode", this can get easily corrupted. So... my final recommendation is this:
const std::map<char, wchar_t> UNICODE_MAP = {
{ 'X', L'\u2588' },
{ 'G', L'\u2593' },
{ 'O', L'\u15e3' },
{ 'P', L'\u15e4' }
};

How can I i get the same result as shown on the docstring

def make_str_from_row(board, row_index):
""" (list of list of str, int) -> str
Return the characters from the row of the board with index row_index
as a single string.
>>> make_str_from_row([['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B']], 0)
'ANTT'
>>> make_str_from_row([['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B']], 1)
'XSOB'
>>> make_str_from_row([['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B'], ['F', 'G', 'O', 'L']], 2)
'FGOL'
"""
Use str.join:
def make_str_from_row(board, row_index):
"""(list of list of str, int) -> str
Return the characters from the row of the board with index row_index
as a single string.
>>> make_str_from_row([['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B']], 0)
'ANTT'
>>> make_str_from_row([['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B']], 1)
'XSOB'
>>> make_str_from_row([['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B'], ['F', 'G', 'O', 'L']], 2)
'FGOL'
"""
return "".join(board[row_index])
print(make_str_from_row([["A", "N", "T", "T"], ["X", "S", "O", "B"]], 0))
print(make_str_from_row([["A", "N", "T", "T"], ["X", "S", "O", "B"]], 1))
print(
make_str_from_row(
[["A", "N", "T", "T"], ["X", "S", "O", "B"], ["F", "G", "O", "L"]], 2
)
)
Prints:
ANTT
XSOB
FGOL

How to display python dict in html table

I have some data stored in a python dict and need to display it in a particular order in html. For example;
values = {
server1 : {'key1' : 'b', 'key2' : 'd'},
server2 : {'key1' : 'e', 'key2' : 'f'},
server3 : {'key1' : 'g', 'key2' : 'h'},
server4 : {'key1' : 'i', 'key2' : 'j'},
server5 : {'key1' : 'k', 'key2' : 'l'},
server6 : {'key1' : 'm', 'key2' : 'n'},
}
should be displayed as:
Thanks
Welcome to StackOverflow! Hope this helps,.
In your input, you need to ensure that there are single quotes around the keys('server1', 'server2',.... ). Otherwise, you can build your dictionary in Python.
>>> values = {
... 'server1' : {'key1' : 'b', 'key2' : 'd'},
... 'server2' : {'key1' : 'e', 'key2' : 'f'},
... 'server3' : {'key1' : 'g', 'key2' : 'h'},
... 'server4' : {'key1' : 'i', 'key2' : 'j'},
... 'server5' : {'key1' : 'k', 'key2' : 'l'},
... 'server6' : {'key1' : 'm', 'key2' : 'n'},
... }
>>>
>>> df = pd.DataFrame(values)
>>> df
server1 server2 server3 server4 server5 server6
key1 b e g i k m
key2 d f h j l n
To conver to HTML format
>>> df.to_html()
'<table border="1" class="dataframe">\n <thead>\n <tr style="text-align: right;">\n <th></th>\n <th>server1</th>\n <th>server2</th>\n <th>server3</th>\n <th>server4</th>\n <th>server5</th>\n <th>server6</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>key1</th>\n <td>b</td>\n <td>e</td>\n <td>g</td>\n <td>i</td>\n <td>k</td>\n <td>m</td>\n </tr>\n <tr>\n <th>key2</th>\n <td>d</td>\n <td>f</td>\n <td>h</td>\n <td>j</td>\n <td>l</td>\n <td>n</td>\n </tr>\n </tbody>\n</table>'
>>>
Using pandas to_html, you can get your HTML data.

How to merge list of dict with same keys?

I have a list:
list=[{'Query': 'documents'}, {'entity': 'a'}, {'value': 'b'}, {'entity': 'c'}, {'value': 'd'}, {'records':21}]
I want following o/p:
d={'Query': ['documents'],'entity': ['a','c'],'value': ['b','d'],'records':[21]}
try this code :
list=[{'Query': 'documents'}, {'entity': 'a'}, {'value': 'b'}, {'entity': 'c'}, {'value': 'd'}, {'records':21}]
d={}
for i in list :
for j,k in i.items():
l = []
if j in d:
l = d[j]
l.append(k)
d[j] = l
else:
l.append(str(k))
d[j]=l
print(d)
output:
{'records': ['21'], 'value': ['b', 'd'], 'entity': ['a', 'c'], 'Query': ['documents']}

Find element in a nested list and transform (groovy)

If I have a Groovy nested list such as:
List list = ['a', 'b', 'c', ['d', 'e', ['f']]]
I would like to be able to search the list for a particular element, say 'd' and then transform that element to something else such as ['g', 'h'] so that the new list looks like:
['a', 'b', 'c', [['g', 'h'], 'e', ['f']]]
Like this??
List list = ['a', 'b', 'c', ['d', 'e', ['f']]]
assert list.collectNested{
if (it == 'd') {
['g', 'h']
} else {
it
}
} == ['a', 'b', 'c', [['g', 'h'], 'e', ['f']]]
Use following generic approach :-
def findAndReplace(def listValue, def listIndex, def valueToCompare, def valueToReplace, def originalList) {
if(listValue instanceof List) {
listValue.eachWithIndex { insideListValue, insideListIndex ->
findAndReplace(insideListValue, insideListIndex, valueToCompare, valueToReplace, listValue)
}
}else if(listValue == valueToCompare) {
originalList[listIndex] = valueToReplace
}
}
List originalList = ['a', 'b', 'c', ['d', 'e', ['f']]]
def valueToCompare = 'd'
def valueToReplace = ['g', 'h']
originalList.eachWithIndex { listValue, listIndex ->
findAndReplace(listValue, listIndex, valueToCompare, valueToReplace, originalList)
}
println originalList
Output: [a, b, c, [[g, h], e, [f]]]
Hope it will help you...:)