import csv to xlsx python

Viewed 3473

I'm trying to put some data from a csv file to exist excel file. my exist excel file contains images and xlrd cannot get images. I try to use xlsxwriter but it cannot append to existing xslx. the only solution I've found is to use openpyxl.

import openpyxl
xfile = openpyxl.load_workbook('my_exist_file')
sheet = xfile.get_sheet_by_name('Sheet1')
with open("my_csv", 'rb') as f:
    reader = csv.reader(f)
    for r, row in enumerate(reader):
        for c, col in enumerate(row):
           -here is my problem- 

how can I write the csv data (that is a table) to a specific location in the exist xslx? I want that my table will start at K2 cell.

thanks!

2 Answers
Related