Skip to content
Advertisement

App Script new Google Sheet creation issue

I am trying to write an App Script that takes string data from multiple different spreadsheets (completely separate documents) and puts them all in a new spreadsheet. When I run the logger, it shows me all the data I want. I want each piece of data to show up in Column A, but when I run my script, it only puts 1 data point in the spreadsheet instead of all of them. Can someone give me some guidance? Here is my code:

JavaScript

Advertisement

Answer

I believe your goal is as follows.

  • You want to retrieve the values from the column “B” of each Spreadsheet under the specific folder.
  • You want to put the retrieved values to the column “A” of the destination sheet.

Modification points:

  • About but when I run my script, it only puts 1 data point in the spreadsheet instead of all of them., when I saw your script, the retrieved value is always put to the cell “A2” of the destination sheet. I think that this might be the reason for your issue.

  • In your script, I thought that when the following flow is used, the process cost will become low. By this flow, your issue can be also removed.

  • In your situation, even when Sheets API is not used, the script might work using getValues().

When these points are reflected in your script, it becomes as follows.

Modified script:

Please set the folder ID and the destination Spreadsheet ID.

JavaScript

Note:

  • Although I’m not sure about your actual situation, when the above script didn’t work by the large data, please modify as follows.

    • From

      JavaScript
    • To

      JavaScript

References:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement