Skip to main content
Participant
September 15, 2025
Question

Moving Layers from One File to Another?

  • September 15, 2025
  • 5 replies
  • 482 views

Hello, everyone.

 

I have a question, that I suspect I know the answer to already... but I need to ask, in the event that someone might be able to identify aworkaround. Here's my dilemma:

 

I work on ads for a major retail chain, and at the very end of Production, we have to make updates to our products star ratings reviews to the most recent number — which have grown since the time we began production. Problem is, it's tedious and time-consuming. I am trying to devise a way to automate, if not simplify, this process.

 

My first idea was to create a new file and import, via our automation process, updated reviews (which reside on their own Layer) from one InDesign file to another. If I could move an entire layer from one file to the next, it would be the silver bullet. Unfortunately, InDesign does not appear to allow one to move an entire layer the way it allows you to Move Pages or Append Style Sheets, etc.

Does anyone have any ideas on how I might be able to execute this move without the need to manually copy-paste dozens of updates per Project?

 

Thanks so much.

5 replies

Fred.L
Inspiring
September 16, 2025

Hey @Darling_0124 

There is already a script done for that 😉

it's rather robust. I've used it quite a few times and worked great.

https://github.com/AdobeInDesignScripts/indesign-copy-layer

 

Community Expert
September 16, 2025

Hi @Darling_0124 ,

below my scripting solution from this other thread written in ExtendScript.

I did a lot of comments there. Please read them before trying the script code.

 

You have to edit the code and insert the right names for the source layer and the target layer.

Both names could be the same. Make sure, that you change "SourceLayer" to "TheNameOfYourLayer" and do that also with "TargetLayer".

 

/*

IMPORTANT NOTES:

The code below works with ONLY two documents open.

sourceDoc : the active open document
targetDoc : the other open document

Make sure that the target document has the same number of pages like the source document.
Make sure that the target document has the named layer you want to duplicate items to.

*/


// The open, active document is the source:
var sourceDoc = app.documents.itemByID( app.documents[0].id );

// The second open document is the target:
var targetDoc = app.documents.itemByID( app.documents[1].id );

// The name of the source layer:
var sourceLayerName = "SourceLayer" ;

// The name of the target layer, that must be already there in the target document.
// Both names could be the same.
var targetLayerName = "TargetLayer" ;

var sourceLayer = sourceDoc.layers.itemByName( sourceLayerName );
var targetLayer = targetDoc.layers.itemByName( targetLayerName );

// Here comes the workaround for the problem reverse order of elements after using duplicate:

var tempDoc = app.open
(
	targetDoc.fullName , true , OpenOptions.OPEN_COPY
);

var tempLayer = tempDoc.layers.itemByName( targetLayerName );

// That produces a reverse order of the original stacking order of elements:
sourceLayer.pageItems.everyItem().duplicate( tempLayer );

// That re-produces the original stacking order of elements in the target document:
tempLayer.pageItems.everyItem().duplicate( targetLayer );


// Close the temp document without saving:
tempDoc.close( SaveOptions.NO );

 

Kind regards,
Uwe Laubender
( Adobe Community Expert )

Community Expert
September 16, 2025

Hi @Darling_0124 ,

we already discussed the issue a couple of years ago with a scripted solution by @heatherw6960836 here:

 

InDesign Script: Issue - copy layer items (using Duplicate), in target file layer items reordering
@heatherw6960836 , Nov 22, 2019

https://community.adobe.com/t5/indesign-discussions/indesign-script-issue-copy-layer-items-using-duplicate-in-target-file-layer-items-reordering/td-p/10756588

 

See my comments to circumvent the problem, that in scripting with duplicate() the stacking order of elements in the target is in reverse order. My solution: "Simply" duplicate the page items of a layer first to yet another document and then duplicate the layer's page items from that to the final document.

https://community.adobe.com/t5/indesign-discussions/indesign-script-issue-copy-layer-items-using-duplicate-in-target-file-layer-items-reordering/m-p/10762682#M165713

 

Or look into @heatherw6960836 's solution, that would perhaps not directly suit your needs where Heather is using copy() and pasteInPlace() spread by spread:

https://community.adobe.com/t5/indesign-discussions/indesign-script-issue-copy-layer-items-using-duplicate-in-target-file-layer-items-reordering/m-p/10764471#M165857

 

Kind regards,
Uwe Laubender
( Adobe Community Expert )

m1b
Community Expert
Community Expert
September 15, 2025

Hi @Darling_0124 it would be worth posting a demo of your set up—just a few pages and a couple of .indd documents and a sample of the review data (.csv or .xlsx or .json?) corresponding to the demo documents.

- Mark

BobLevine
Community Expert
Community Expert
September 15, 2025

I'm guessing this could be scripted...not by me, mind you...but it seems simple enough even manually. Lock the other layers, select all, copy and then paste in the other file.

Participant
September 15, 2025

I only thought that InDesign could copy from one page at a time — not an entire layer. These are multi-page files I work with. Sometimes, over 100 pages with these star review elements on each of them.

Thank you for the reply!

Joel Cherney
Community Expert
Community Expert
September 15, 2025

That is a limitation of copying and pasting in InDesign, but it wouldn't be hard to work around that limitation in a script. I can imagine making an array of all pages in the source doc, verifying that you had an open target doc with the correct number of pages, then looping through those pages one by one, copying all of the content in the specified layer, pasting it into the corresponding layer on the corresponding page of the target doc. I wouldn't guess that this would be the easiest way to do it - I'm not looking at your entire workflow, so I might well be wrong about that - but it's absolutely doable. 

 

Is it just numerical data that needs to be updated at the end of production? "4.5 stars, 382 votes" or something along those lines? How do the new star-counts get delivered to you? Lots of possible automation possibilities there... e.g. the numbers of stars and numbers of votes could be stored in placed-and-linked text files. Update those text files, then the next time you open the INDD and are prompted to update links, and all of those files would get updated. Or you could tag every review with XML tags, then Import XML with new values whenever your reviews get updated?