I recently joined this forum and have just started using Google Scripts. I don't have any prior experience with JavaScript or programming languages, but had to learn them when I decided to use Google Apps as the main platform for my small business.
My issue lies in the limitation of the ImportRange function in Google Sheets to 50 on each spreadsheet. I've set up a model where each customer has their own spreadsheet with personal data, deadlines, etc., stored in their individual folder on Google Drive.
In addition, I've created a spreadsheet called "Organizer" which serves two functions -
1) automatically generates correspondence using the autoCrat script, 2) displays deadlines for each customer and sorts them by priority.
Therefore, I need to share/import/copy data from all customer spreadsheets into the "Organizer". Since there are more than 50 customer spreadsheets, I had to abandon the ImportRange function. Instead, I'm using a simple script to directly copy files from every spreadsheet:
function ImportDataRange() {
// row number.1
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Database");
var range = sheet.getRange(2, 1)
var id = range.getValue()
var ssraw = SpreadsheetApp.openById(id);
var sheetraw = ssraw.getSheetByName("Raw");
var range = sheetraw.getRange("A2:AB2");
var data = range.getValues();
sheet.getRange("B2:AC2").setValues(data)
// row number.2
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Database");
var range = sheet.getRange(3, 1)
var id = range.getValue()
var ssraw = SpreadsheetApp.openById(id);
var sheetraw = ssraw.getSheetByName("Raw");
var range = sheetraw.getRange("A2:AB2");
var data = range.getValues();
sheet.getRange("B3:AC3").setValues(data)
}
The script works well, but the issue arises when I try to add a new customer spreadsheet to the "Organizer" using this method. I have to manually add a new copy of the entire code for each new row and also adjust the output range of imported data and the location of the source file ID in the "Organizer".
Does anyone know of a workaround that would make it easier/automatic to add new rows/customer data?
Thank you for your assistance!