When will Table to Table support .xlsx files?

3525
14
01-27-2011 12:24 PM
DanielSheehan
New Contributor II
Is there any plan for exporting tables in ArcCatalog from .xlsx files? .xls still work fine. It just slows everything down and not sure how to avoid doing it manually by integrating it with my Python scripts. I wish Microsoft didn't get rid of save to .dbf in Excel.

PS I know GIS data should be in databases not in spreadsheets but so much source data comes in excel.
Tags (2)
14 Replies
MaximeDemers
Occasional Contributor III

It's a shame that in 2016 ArcGIS cannot export a table to xlsx dirrectly!

0 Kudos
DarrenWiens2
MVP Honored Contributor

Not sure if this is the type of answer you're looking for, but since you're already using Python scripts...

XlsxWriter 0.8.5 : Python Package Index

>>> import xlsxwriter # import library
... fc = 'points' # feature class/layer
... workbook = xlsxwriter.Workbook('C:\junk\my_new_workbook.xlsx') # new workbook
... worksheet = workbook.add_worksheet() # create worksheet
... fieldnames = [i.name for i in arcpy.ListFields(fc)] # list fields in fc
... for field,fieldname in enumerate(fieldnames): 
...    worksheet.write(0,field,fieldname) # write field names to xlsx
... with arcpy.da.SearchCursor(fc,'*') as cursor: # loop through features
...    for row,row_val in enumerate(cursor): # loop through rows
...        for col,col_val in enumerate(row_val): # loop through columns
...            try:
...                worksheet.write(row+1,col,col_val) # if text or number, write value
...            except:
...                worksheet.write(row+1,col,repr(col_val)) # if something else (like a shape) write the representation
... workbook.close() # close the workbook

edit: just realized the original post was made 5 years ago, so it's possible that xlsxwriter didn't exist then, but it does now!

0 Kudos
DanPatterson_Retired
MVP Emeritus

I think that it is the Friday afternoon migratory ghosts Darren...this isn't only only old post to come through

AdrianWelsh
MVP Honored Contributor

Dan, this is interesting. How often do these 'ghosts' practice their migrating? Is this why we see old stuff get bumped a lot?

0 Kudos
DanPatterson_Retired
MVP Emeritus

Cleanup is done by us moderators during downtime ... which varies according to traffic and who is awake.

Old threads can get bumped when the poster makes an edit, a moderator changes a question to a discussion or when someone marks a question answered, or... when someone answers an old question that gets bumped then realizes the thread is many years old.

This gives others the opportunity to recommend options that someone else already posted since the order of threads in the mailbox is not in chronological order...ergo my response to Darren's missive.

Pretty well sums it up... On the upside, the original poster's email will be flooded with new traffic for something long forgotten...

PS moving to Managing Data​ since the generic GIS category is too generic

0 Kudos
AdrianWelsh
MVP Honored Contributor

This makes sense. So it's safe to say that these 'ghosts' are just the moderators moderating? I am guessing there is no automatic migration that is making old threads get bumped?

0 Kudos
DanPatterson_Retired
MVP Emeritus

not automatically... just automagically

curtvprice
MVP Esteemed Contributor

Also, Esri has shipped tools to read and write Excel files. (They use Python modules that are shipped with ArcGIS.)

Here's the current story on Excel support in the help.

Understanding how to use Microsoft Excel files in ArcGIS—Help | ArcGIS for Desktop

0 Kudos
DarrenWiens2
MVP Honored Contributor

But they only write to xls, not xlsx, as far as I know. Is there a method to write to xlsx out of the box?

0 Kudos