'Python - save a column in Excel with a lot of rows with random UUIDs

I have the following code:

import xlsxwriter
import numpy as np
import pandas as pd
import random
import uuid
LIMIT=1000
workbook = xlsxwriter.Workbook('test.xlsx')
worksheet = workbook.add_worksheet()
for row in range(0,LIMIT):
    worksheet.write_column(row, 0, uuid.uuid4())
    row += 1
workbook.close()

I get the following error:

TypeError: 'UUID' object is not iterable

I tried converting the UUID to a string using str() but that just gives me a single digit or letter in the excel sheet for some reason.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source