In my data the NAME field refers to Fire Station Boundaries and the Pg_Number refers to the page in the mapbook. I'm trying to convert or create a table so that all pages that are within each boundary are listed together, separated by a comma.

So instead of the table as it was originally uploaded, you would get a result of:

There are 33 unique NAME attributes. I need to create a mapbook of each NAME

The goal after getting this would be then to take the page list and push it to export to pdf those pages.

I went through the process manually yesterday and it was awful. I wound up taking that table, opening it in excel, downloading KuTools, using their combine tool to create the page listings (manually selecting which cells), then individually taking those page ranges and taking it back into ArcMap MapLogic tools and exporting from there. 10 hours of click.click.click. ugh.

I haven't tested this exactly but it should get you on the right path. It cursors through your initial table creating a dictionary of key, list values. Then it uses an insert cursor to basically inject those dictionary keys and lists into a new table using the same field names. You'd have to either create the new table or add that aspect to the script.

I appreciate your time and help. I'm also getting an error that my dbf file doesn't exist, so I converted it to an xlsx and don't get that error. Not sure if that matters, and for the new table I just created an empty excel spreadsheet. That could be wrong too. As you can tell. I'm new to this. thanks for your patience.

Also you'll want to make it a dbf or fgdb table, something Arc can read easily. Excel is not great for that. You'll also have to create this before you run your script. Make sure the field you want to all the values in is a long enough string field.

Don't open the table that way, that is for a different kind of accessing. The cursor handles all the back end you need. Your outPath variable should be to a place on disk, not in memory. Your new_table variable should just be the name of the table not the path.

You need to create your target table with the field names and properties you want. You could modify the insertCursor object creation to have different field names if you'd like, but yes they will have to created already.

The NAME field doesn't need to fit that many characters, The Pg_Number field needs to be long, I've adjusted it to its maximum size (which is apparently only 254 characters?) However, one of the NAME fields has 74 different page numbers plus the ", " so its maximum size should be set to 370