• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Find/Change in InDesign depending on xls file

New Here ,
Nov 26, 2020 Nov 26, 2020

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?

TOPICS
Scripting

Views

234

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Nov 26, 2020 Nov 26, 2020

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 26, 2020 Nov 26, 2020

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 26, 2020 Nov 26, 2020

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 26, 2020 Nov 26, 2020

Copy link to clipboard

Copied

Like this?Schermata 2020-11-26 alle 14.45.37.png

 

This is my excel (in the catalog I have 3256c odes in total)

Schermata 2020-11-26 alle 14.50.12.png

 

Thanks in advance for any suggestion.

Massimo

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 26, 2020 Nov 26, 2020

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!  😉 ]

 

(^/)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 26, 2020 Nov 26, 2020

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 26, 2020 Nov 26, 2020

Copy link to clipboard

Copied

LATEST

Simplistically:

 

Before the script:

 

Capture d’écran 2020-11-26 à 15.44.47.png

 

After it:

 

Capture d’écran 2020-11-26 à 15.44.28.png

 

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!  😉

 

(^/)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines