I am trying to generate a sales graph using xlsxwriter. In y-axis, the values are coming as 20000, 40000 etc. I want it come as 10k, 20k etc.
Is it possible to do same in excel using xlsxwriter.
I am trying to generate a sales graph using xlsxwriter. In y-axis, the values are coming as 20000, 40000 etc. I want it come as 10k, 20k etc.
Is it possible to do same in excel using xlsxwriter.
You can use format cell in xlsxwriter
package (see following sample code):
rowCounter = 0
formatCell = workbook.add_format({ 'num_format' : '0.00"k"' })
for _, colValue in (dataToWrite) :
worksheet.write(rowCounter, 0, colValue/1000,formatCell)
rowCounter += 1
chart = workbook.add_chart({'type' : 'line'})
chart.add_series({"values" : "=Sheet1!$A$1:$A$4"})
worksheet.insert_chart('D1' , chart)
NOTE : Above code tested on xlsxwriter
version : 1.2.9