Copy link to clipboard
Copied
Hi guys!
I would like to update a catalog with prices.
In my Indesign document, I have many tables with:
- "code" (unique ID)
- Description
- EAN
- price
Is there a way to update the Indesign file by finding each code from an Excel (or csv) and updating the old price with the new price in?
Copy link to clipboard
Copied
Hello,
You can take a look at the post below to see if this what you're looking for....
https://www.marspremedia.com/software/indesign/find-change-from-spreadsheet
Regards,
Mike
Copy link to clipboard
Copied
Thanks, Mike, but in my scenario I have 3 columns that determine the replacement:
- code
- old content (price)
- new content (new price).
In the post you suggested to me, I understood that the find/replace is between two values, without a third value determining where to make the substitution (code).
I hope I was clear
Thanks in advance for any suggestion.
Massimo
Copy link to clipboard
Copied
Simplistic to be played!
Could you post an ID sample page with tables (preview mode with invisible chars)?
(^/) The Jedi
Copy link to clipboard
Copied
Like this?
This is my excel (in the catalog I have 3256c odes in total)
Thanks in advance for any suggestion.
Massimo
Copy link to clipboard
Copied
Could you post the ID table (saved in .idml) + the corresponding Excel part saved in .txt (with tabs)? [truly too lazy today! 😉 ]
(^/)
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Simplistically:
Before the script:
After it:
Using this kind of code:
/*
by FRIdNGE, Michel Allio [26/11/2020]
*/
// Waiting for the reading of the .txt file by the script ----------------------------------------------------------------------
var myChanges = [ "1070100;3,05", "1070101;3,35", "1070102;3,84", "1070103;4,21", "1070104;4,62" ],
C = myChanges.length, c ;
// --------------------------------------------------------------------------------------------------------------------------------------
var myTables = app.activeDocument.stories.everyItem().tables,
T = myTables.length, t ;
for ( t = 0; t < T ; t++ ) {
var myRows = myTables[t].rows,
R = myRows.length, r ;
for ( r = 0; r < R ; r++ ) for ( c = 0; c < C; c++ ) if ( myRows[r].cells[1].contents == myChanges[c].split(";")[0] ) myRows[r].cells[6].contents = myChanges[c].split(";")[1];
}
alert( "Done! …" )
If you want more, pm me or wait for a scripter less lazy than me today! 😉
(^/)