number instead of date string when writing xlsx file
<p>In a LibreOffice xlsx cell, the value is like this: 01/13/2016.
When I am creating a new xlsx file using python2, then that 01/13/2016 is converting to 42461.</p>

<p>python code :</p>

<pre><code>sheet1.write(row,col,sheet.cell(row,col).value) 
tab_matching = 0
for sheet_name in book.sheet_names():   

temp_sheet_name = sheet_name.lower()
if temp_sheet_name == tab_name: 
    tab_matching = 1

    sheet = book.sheet_by_name(sheet_name)
    temp_sheet_name = file_prefix+part_file_name+"_"+file_type+".xlsx"
    if os.path.exists(detail_path):
        xlsx_file_name = detail_path+"/"+temp_sheet_name
    else:
        xlsx_file_name = dirname+"/"+temp_sheet_name

    new_book = xlsxwriter.Workbook(xlsx_file_name)
    sheet1 = new_book.add_worksheet()


    for row in range(sheet.nrows):

        for col in range(sheet.ncols):  
            sheet1.write(row,col,sheet.cell(row,col).value)     

    new_book.close()
</code></pre>

<p>Could you tell me why this is happening?</p>

<p><code>42461</code> is the underlying date value for 04/01/2016.  To show the date instead of the number, specify a date format:</p>

<pre><code>format1 = new_book.add_format({'num_format': 'mm/dd/yyyy'})
sheet1.write('B1', 42461, format1)  # 04/01/2016
sheet1.write('B2', 42382, format1)  # 01/13/2016
</code></pre>

<p>Documentation is at <a href="http://xlsxwriter.readthedocs.io/working_with_dates_and_time.html" rel="nofollow">http://xlsxwriter.readthedocs.io/working_with_dates_and_time.html</a>.</p>

python libreoffice xlsxwriter