How to copy and Paste a IMPORTRANGE cell value and not get a "loading" value through google script?

Viewed 738

I currently have a spreadsheet that imports data from google sheets workbook to another.

The first macro step is it writes the required "IMPORTRANGE" formulas in the specific places.

My next macro step copy and pastes (as values) those cells where the "IMPORTRANGE" formula has been entered onto themselves so that it breaks the fomrula and leaves the correct value there.

At the moment I keep getting "Loading" copying and pasting over the top even though after I run the first macro I can see the value there on the sheet.

Copy and paste code below:

''''

"Page 1 instructions"

spreadsheet.getRange('Instructions!D3:F3').copyTo(spreadsheet.getRange('Instructions!D3:F3'), SpreadsheetApp.CopyPasteType.PASTE_VALUES, true); spreadsheet.getRange('Instructions!F5').copyTo(spreadsheet.getRange('Instructions!F5'), SpreadsheetApp.CopyPasteType.PASTE_VALUES, true); spreadsheet.getRange('Instructions!H5').copyTo(spreadsheet.getRange('Instructions!H5'), SpreadsheetApp.CopyPasteType.PASTE_VALUES, true); spreadsheet.getRange('Instructions!D42').copyTo(spreadsheet.getRange('Instructions!D42'), SpreadsheetApp.CopyPasteType.PASTE_VALUES, true);

''''

0 Answers
Related