Copy link to clipboard
Copied
Hi. I'm curious if there is a way to change the fill color of, say a rectangle, in Illustrator based on data in an excel spreadsheet (csv or whatever). For example: say the data in the excel cell is 1 and that corresponds to the rectangle in Illustrator having a yellow fill... Now say I update the data in the cell to 2 and save. I run the script and it makes the box red. Is that even remotely possible? Thanks.
Copy link to clipboard
Copied
Hi, yes it's possible, I used VBA on Windows
Assuming you have an Illustrator file with 1 square, and 2 swatches named "yellow" and "red"
this is how I set up the excel file
type the formula in cell F2 as shown, make your color updates on cell E2
VBA code:
Sub recolorSquare()
Dim iapp As New Illustrator.Application
Dim idoc As Illustrator.Document
Dim rect As Illustrator.PathItem
Dim whatColor As String
whatColor = range("F2")
Set idoc = iapp.ActiveDocument
Set rect = idoc.PathItems(1)
rect.FillColor = idoc.Swatches(whatColor).Color
Set rect = Nothing
Set idoc = Nothing
Set iapp = Nothing
End Sub
Copy link to clipboard
Copied
It is also possible to interact directly with some spredsheet data on the mac using AppleScript. Both FMP and Excel support AppleScript. If you were to use Adobe's ExtendScript then the data would need to be exported to delimited text file then read in… for use…
Copy link to clipboard
Copied
Thanks so much! Going to try this out!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more