pythonsqlarraysstringpyxll

pyxll return array of strings


I'm creating a xl_func that receives data from sql server (string) and return to excel (auto_resize=True). The end of the code is:

result = cursor.fetchall()
final_result = [row[0] for row in result]
return final_result

It runs okay, but it returns each character in a different column. enter image description here


Solution

  • I found the solution:

    result = cursor.fetchall()
    final_result = [row[0:1] for row in result]
    return final_result