Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Problem writing all columns with xlwt

$
0
0
Hello, I am having an issue getting all of the values from my table written into the .xls I can get a single row, but need all of the columns.

Code:

# Use row object to get and set field values
cur = arcpy.SearchCursor(data_source)


# Set up workbook and sheet
book = Workbook()
sheet1 = book.add_sheet('Points')


# Set counter
rowx = 0


# Loop through rows in dbf file.
arcpy.AddMessage(cur)
for row in cur:
    rowx += 1
    # Write each row to the sheet from the workbook. Set column index in sheet for each column in .dbf
    sheet1.write(rowx,0,row.ID)
    book.save('C:/Output')


print"Export finished"

In the line
Code:

sheet1.write(rowx,0,row.ID)
I need 3 parameters where rowx = walks through and gets all values in every row - 0 = column index of where the values are written in the xls & row.ID = the column that is being written from table.

Any help is greatly appreciated.

Viewing all articles
Browse latest Browse all 2485

Trending Articles