Introduction to xlsxwriter

preview_player
Показать описание
xlsxwriter allows you to convert Python data to Excel, which makes it useful for automating otherwise error prone and costly tasks in your workflow.

xlsxwriter workbooks have several worksheets, which allow you to enter and format data in your Excel file. Writing to cells, columns, rows, and leverageing these within loops with style themes are covered in this presentation.

The tutorials in this series aim to give you the skills required to apply these things using xlsxwriter.
Рекомендации по теме
Комментарии
Автор

Another helpful video.

Just a few points to add to the 8a example if anybody, like me, is actually typing it up to play with and understand it:

1: If you're using python 3.x, use range() instead of xrange() as xrange is no longer supported in Python 3.
2: The clever fill_columns function is designed to work on what ever spreadsheet you feed the function. However, the line specifies the analysis spreadsheet. Changing this to worksheet.write_column will make the function work on the spreadsheet you tell it to. (Not important for this task, but if you incorporate it into your own project, this could be helpful).

I really appreciate the video and will work through your others. Thanks!

davidbristoll
Автор

thanks :) I love to learn more about it

ThaoNguyen-wzkc
Автор

excellent, thanks. by the way, Can this tool control existing excel file instead of create new?

midzoo
Автор

Hello Guys,

Let me know if we can increase cell width using this module xlsxwriter.

pankajchaturvedi
Автор

Hello!
Thank you for this good content and information. I’m not a pro in Python but I try to learn it. I have a problem to get this script to work, or it halv-works. I try to generate combinations and print those to an excel file. When I run the script only the Combinations are shown on screen, but no excel file is created for those combinations. What I’m doing wrong here? Strange thins is I got no error messsge either. Can you please give me any advice, thank you..
Here’s the code:

import itertools
import os
import xlsxwriter

row = 0
col = 0

combin = itertools.combinations(range(1, 15), 7)
count_combin = []
count = 0

for i in combin:
count_combin.append(i)
print(count_combin.index(i)+1, i)
workbook = xlsxwriter.Workbook( os.getcwd() + '\\' + 'combination.xlsx')
worksheet =
worksheet.write(row, col, i[0])
worksheet.write(row, col+1, i[1])
worksheet.write(row, col+2, i[2])
worksheet.write(row, col+3, i[3])
worksheet.write(row, col+4, i[4])
worksheet.write(row, col+5, i[5])
worksheet.write(row, col+6, i[6])

row += 1

workbook.close

print('number of combinations', len(count_combin))

khalilj.