.swp macro
Import Properties from CSV: bulk write properties
Writes custom properties into documents from a spreadsheet. Reads the long-format CSV that Export Properties to CSV writes, picks the rows belonging to each document, and writes them.
Download Import Properties from CSV.swp Get SwMacroFlow
Put the downloaded file in this folder, then open SwMacroFlow and choose it from the library.
%LOCALAPPDATA%\SwMacroFlow\macros
Runs per file — point the scope at the same folder you exported from, edit the CSV in between.
> This macro has the largest blast radius in the library. It writes to every file in the scope > from a spreadsheet a human has edited. It therefore defaults to Preview, which writes nothing.
Inputs
| Field | Purpose |
|---|---|
| CsvPath | The CSV to read. Must already exist — the file picker will not accept a path that does not. |
| Mode | Preview (report only) by default, or Apply changes. |
| MatchBy | File path or File name. File name is the forgiving option when the CSV was exported before the files moved. |
Run Preview first
In Preview the macro does everything except write: it matches rows, compares each value against what the document holds, and reports exactly what would change —
Preview - would change 3, leave 11. Revision: A -> B. [Config1] Cost: (new) -> 42. ...Every previewed file comes back as a Warning, not an OK, so a 300-file preview makes it obvious at a glance that nothing was written. Export the results to CSV from the results panel if you want the full list to review. Then switch Mode to Apply changes and run the same job again.
What counts as a change
A row is skipped when the document already holds that exact value. The comparison is against the stored value, never the resolved one — a property holding D1@Sketch1 resolves to a number, and comparing against that number would look like a difference on every run and would overwrite the expression with its own answer, permanently.
The comparison is case-sensitive, so correcting abc-123 to ABC-123 is a change.
Columns it reads
PropertyName and Value are required. FilePath or FileName is required depending on MatchBy. Configuration is optional — blank or absent means the file-level property store.
Type and ResolvedValue are ignored. Writing ResolvedValue back would bake a computed number over the expression that produced it.
Encoding
The file is read in whatever encoding it was saved in — the byte order mark decides between UTF-16LE, UTF-16BE, UTF-8 and Windows-1252. That matters because the whole point of this macro is that a human edited the file in between, and Excel's CSV UTF-8 and plain CSV save it as different things. A UTF-8 file read as ANSI would turn every accented character into mojibake and write that into the documents.
Quoted fields, doubled quotes and line breaks inside a quoted field are all parsed properly. A part description containing a comma will not shift the later columns on its row.
Results
| Outcome | Meaning |
|---|---|
| OK | Applied and saved. Names the first few changes and counts the rest. |
| Warning | Preview, or nothing needed changing, or no CSV row mentions this document. |
| Error | Read-only, never saved, missing required column, unreadable CSV, or the save failed. |
Read-only is checked before the CSV is even read. SOLIDWORKS accepts a property into the in-memory document quite happily and only refuses at save time, so a late check would report a clean run for a file that never changed on disk.
Notes
Speed. The CSV is re-read for each document in the batch. Before parsing, a fast scan checks whether the document is mentioned at all, so a CSV covering only part of the scope costs almost nothing for the rest. A large CSV that mentions every file adds a fraction of a second per document — small next to the time SOLIDWORKS takes to open one.
Chaining
Place it before any export macro so the exported files carry the new values. It saves the document in Apply mode, and does nothing at all in Preview.