by Dennis Collin
I recently wrote a post on AutoCAD’s ability to extract data out to Excel or into an AutoCAD table object.
However, sometimes there might be a requirement for the data to be extracted to Excel or another external database program, edit the data in that program and then transfer back the modified data back into the drawing and update the block attribute data to suit.
This functionality has been in AutoCAD for some time with its Express Tools suite.
Fig. Import Attributes (ATTIN) and Export Attributes (ATTOUT)
The two relevant commands are ATTOUT which allows block attribute data to be exported to a file for convenient review and modification. The second command is ATTIN which imports modified attribute values back into the original drawing. These commands can be accessed either via the ribbon menu or command line as desired.
Fig. Selecting the data to export using the ATTOUT command
Using the ATTOUT command, a filename needs to be specified before specifying the blocks that you want to process. The attribute data within the selected blocks will be written to the specified file. The exported file is a tab-delimited, text file that can be accessed by most database and spreadsheet programs including Microsoft Excel. When saving the modified file, ensure it is saved in a tab-delimited ASCII format, otherwise the ATTIN command may not be able to correctly interpret the data from the file.
Fig. The exported attributed data in ASCII form. The handle field will be used to map the modified data back into the drawing later.
Excel is a good tool to edit data as it is easy (even for a novice user) to mass populate or edit cells, apply incremental numbers and add formulas, totals etc.
Fig. Data being modified within MS Excel
Once the edits are complete, save the data out to a Tab delimited file. It is often worth checking in the Notepad application that the file has not had column headers added. If so, take them out so that the headers match the original exported file.
Fig. Saving modified data out to tab delimited text file.
Switching back to AutoCAD, run the ATTIN command , browse to the modified data file and import it. If the formatting is correct the attributes will update as expected. If there are minor formatting issues the blocks might need to be selected interactively. As a reference the modified file should look similar to the original exported version of text file, albeit with some changes in values.
Fig. ATTIN prompts to pick the modified text file.
Fig. Provided there are no formatting errors in the text file, the attribute values are updated automatically!
The Express Tools described are only a feature with full AutoCAD and are not available for AutoCAD LT.