How use the ImportRange Refresh script?
up vote
0
down vote
favorite
I do not know Script.
I have found a way to reference an external sheet faster than ImportRange, but I do not know how to use this script.
Can I get an example that uses this script?
I need help.
// this function creates a menu item on the top that you can click the refresh the data, you could also use triggers to refresh
function onOpen() {
var spreadsheet = SpreadsheetApp.getActive();
var menuItems = [{name: 'Refresh', functionName: 'getData'}];
spreadsheet.addMenu('Menu', menuItems);
}
function getData() {
var key = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1").getRange("A1").getValue(); // you would place the spreadsheet key in A1, alternatively you can enter the key directly here rather than referencing
var sourceSs = SpreadsheetApp.openById(key);
var sourceSheet = sourceSs.getSheetByName("Sheet1");
var sourceRange = sourceSheet.getRange("A1:C");
var sourceValues = sourceRange.getValues();
var destSs = SpreadsheetApp.getActiveSpreadsheet();
var destSheet = destSs.getSheetByName("Sheet1");
var desRange = destSheet.getRange("A1:C")
destRange.setValues(sourceValues);
}
Sorry. I do not seem to be properly delivered because I am not fluent in English.
I had to come to StackOverFlow because there were very few GAS users in Korea.
Initially, // my level knows how to use most of the functionality of a spreadsheet, except scripts.
I've had over 100,000 rows in my experience, and after splitting the sheet, I used the IMPORTRANGE function to collect the results in a single spreadsheet.
However, this spreadsheet had a huge amount of real-time updates, so we had to find a way to speed it up.
After that, I found the source code above and saved it. However, an error occurred at destRange.setValues (sourceValues); at the bottom.
I tried to modify the source code, but the result is the same.
I think you can see how to use the source code in the examples that are actually applied.
google-apps-script
New contributor
add a comment |
up vote
0
down vote
favorite
I do not know Script.
I have found a way to reference an external sheet faster than ImportRange, but I do not know how to use this script.
Can I get an example that uses this script?
I need help.
// this function creates a menu item on the top that you can click the refresh the data, you could also use triggers to refresh
function onOpen() {
var spreadsheet = SpreadsheetApp.getActive();
var menuItems = [{name: 'Refresh', functionName: 'getData'}];
spreadsheet.addMenu('Menu', menuItems);
}
function getData() {
var key = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1").getRange("A1").getValue(); // you would place the spreadsheet key in A1, alternatively you can enter the key directly here rather than referencing
var sourceSs = SpreadsheetApp.openById(key);
var sourceSheet = sourceSs.getSheetByName("Sheet1");
var sourceRange = sourceSheet.getRange("A1:C");
var sourceValues = sourceRange.getValues();
var destSs = SpreadsheetApp.getActiveSpreadsheet();
var destSheet = destSs.getSheetByName("Sheet1");
var desRange = destSheet.getRange("A1:C")
destRange.setValues(sourceValues);
}
Sorry. I do not seem to be properly delivered because I am not fluent in English.
I had to come to StackOverFlow because there were very few GAS users in Korea.
Initially, // my level knows how to use most of the functionality of a spreadsheet, except scripts.
I've had over 100,000 rows in my experience, and after splitting the sheet, I used the IMPORTRANGE function to collect the results in a single spreadsheet.
However, this spreadsheet had a huge amount of real-time updates, so we had to find a way to speed it up.
After that, I found the source code above and saved it. However, an error occurred at destRange.setValues (sourceValues); at the bottom.
I tried to modify the source code, but the result is the same.
I think you can see how to use the source code in the examples that are actually applied.
google-apps-script
New contributor
What have you tried so far?
– TheMaster
yesterday
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I do not know Script.
I have found a way to reference an external sheet faster than ImportRange, but I do not know how to use this script.
Can I get an example that uses this script?
I need help.
// this function creates a menu item on the top that you can click the refresh the data, you could also use triggers to refresh
function onOpen() {
var spreadsheet = SpreadsheetApp.getActive();
var menuItems = [{name: 'Refresh', functionName: 'getData'}];
spreadsheet.addMenu('Menu', menuItems);
}
function getData() {
var key = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1").getRange("A1").getValue(); // you would place the spreadsheet key in A1, alternatively you can enter the key directly here rather than referencing
var sourceSs = SpreadsheetApp.openById(key);
var sourceSheet = sourceSs.getSheetByName("Sheet1");
var sourceRange = sourceSheet.getRange("A1:C");
var sourceValues = sourceRange.getValues();
var destSs = SpreadsheetApp.getActiveSpreadsheet();
var destSheet = destSs.getSheetByName("Sheet1");
var desRange = destSheet.getRange("A1:C")
destRange.setValues(sourceValues);
}
Sorry. I do not seem to be properly delivered because I am not fluent in English.
I had to come to StackOverFlow because there were very few GAS users in Korea.
Initially, // my level knows how to use most of the functionality of a spreadsheet, except scripts.
I've had over 100,000 rows in my experience, and after splitting the sheet, I used the IMPORTRANGE function to collect the results in a single spreadsheet.
However, this spreadsheet had a huge amount of real-time updates, so we had to find a way to speed it up.
After that, I found the source code above and saved it. However, an error occurred at destRange.setValues (sourceValues); at the bottom.
I tried to modify the source code, but the result is the same.
I think you can see how to use the source code in the examples that are actually applied.
google-apps-script
New contributor
I do not know Script.
I have found a way to reference an external sheet faster than ImportRange, but I do not know how to use this script.
Can I get an example that uses this script?
I need help.
// this function creates a menu item on the top that you can click the refresh the data, you could also use triggers to refresh
function onOpen() {
var spreadsheet = SpreadsheetApp.getActive();
var menuItems = [{name: 'Refresh', functionName: 'getData'}];
spreadsheet.addMenu('Menu', menuItems);
}
function getData() {
var key = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1").getRange("A1").getValue(); // you would place the spreadsheet key in A1, alternatively you can enter the key directly here rather than referencing
var sourceSs = SpreadsheetApp.openById(key);
var sourceSheet = sourceSs.getSheetByName("Sheet1");
var sourceRange = sourceSheet.getRange("A1:C");
var sourceValues = sourceRange.getValues();
var destSs = SpreadsheetApp.getActiveSpreadsheet();
var destSheet = destSs.getSheetByName("Sheet1");
var desRange = destSheet.getRange("A1:C")
destRange.setValues(sourceValues);
}
Sorry. I do not seem to be properly delivered because I am not fluent in English.
I had to come to StackOverFlow because there were very few GAS users in Korea.
Initially, // my level knows how to use most of the functionality of a spreadsheet, except scripts.
I've had over 100,000 rows in my experience, and after splitting the sheet, I used the IMPORTRANGE function to collect the results in a single spreadsheet.
However, this spreadsheet had a huge amount of real-time updates, so we had to find a way to speed it up.
After that, I found the source code above and saved it. However, an error occurred at destRange.setValues (sourceValues); at the bottom.
I tried to modify the source code, but the result is the same.
I think you can see how to use the source code in the examples that are actually applied.
google-apps-script
google-apps-script
New contributor
New contributor
edited 9 hours ago
New contributor
asked yesterday
김지민
11
11
New contributor
New contributor
What have you tried so far?
– TheMaster
yesterday
add a comment |
What have you tried so far?
– TheMaster
yesterday
What have you tried so far?
– TheMaster
yesterday
What have you tried so far?
– TheMaster
yesterday
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
You need to do a few things, not hard but specific:
1) Get the keys to the source and target spreadsheets. These are the long gobbledy-gook strings inside the URL that opens the sheet. If you see a URL like this: https://docs.google.com/spreadsheets/d/1fPvp5o2-xeH04STyeaoC_iJTy1JRGQZki3_j1l39wMQ/edit#gid=0, the ID of the sheet is the part after spreadsheets/d/ and before /edit. Place those keys in the code for sourceSs and destSs.
Open the target sheet. From the menu choose Tools -> Script editor. Assuming you've done nothing so far, you'll get a default "MyFunction()". Clear that text and copy/paste your code above, including the keys. Save the code. Close the code window, close the spreadsheet and reopen the target spreadsheet.
To actually update the values on the target spreadsheet, the user will be required to select the menu item "Refresh". The first time, the user will be required to authorize permissions to the script.
Give this a try. It's quite straightforward, once you know how.
New contributor
File is not available by your link
– Boris Sokolov
yesterday
Boris, I only used that as a sample - I modified it intentionally to avoid giving away a real file from My Drive.
– Michael Ellis
yesterday
Ah... I thought it was a part of your sample :)
– Boris Sokolov
yesterday
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You need to do a few things, not hard but specific:
1) Get the keys to the source and target spreadsheets. These are the long gobbledy-gook strings inside the URL that opens the sheet. If you see a URL like this: https://docs.google.com/spreadsheets/d/1fPvp5o2-xeH04STyeaoC_iJTy1JRGQZki3_j1l39wMQ/edit#gid=0, the ID of the sheet is the part after spreadsheets/d/ and before /edit. Place those keys in the code for sourceSs and destSs.
Open the target sheet. From the menu choose Tools -> Script editor. Assuming you've done nothing so far, you'll get a default "MyFunction()". Clear that text and copy/paste your code above, including the keys. Save the code. Close the code window, close the spreadsheet and reopen the target spreadsheet.
To actually update the values on the target spreadsheet, the user will be required to select the menu item "Refresh". The first time, the user will be required to authorize permissions to the script.
Give this a try. It's quite straightforward, once you know how.
New contributor
File is not available by your link
– Boris Sokolov
yesterday
Boris, I only used that as a sample - I modified it intentionally to avoid giving away a real file from My Drive.
– Michael Ellis
yesterday
Ah... I thought it was a part of your sample :)
– Boris Sokolov
yesterday
add a comment |
up vote
0
down vote
You need to do a few things, not hard but specific:
1) Get the keys to the source and target spreadsheets. These are the long gobbledy-gook strings inside the URL that opens the sheet. If you see a URL like this: https://docs.google.com/spreadsheets/d/1fPvp5o2-xeH04STyeaoC_iJTy1JRGQZki3_j1l39wMQ/edit#gid=0, the ID of the sheet is the part after spreadsheets/d/ and before /edit. Place those keys in the code for sourceSs and destSs.
Open the target sheet. From the menu choose Tools -> Script editor. Assuming you've done nothing so far, you'll get a default "MyFunction()". Clear that text and copy/paste your code above, including the keys. Save the code. Close the code window, close the spreadsheet and reopen the target spreadsheet.
To actually update the values on the target spreadsheet, the user will be required to select the menu item "Refresh". The first time, the user will be required to authorize permissions to the script.
Give this a try. It's quite straightforward, once you know how.
New contributor
File is not available by your link
– Boris Sokolov
yesterday
Boris, I only used that as a sample - I modified it intentionally to avoid giving away a real file from My Drive.
– Michael Ellis
yesterday
Ah... I thought it was a part of your sample :)
– Boris Sokolov
yesterday
add a comment |
up vote
0
down vote
up vote
0
down vote
You need to do a few things, not hard but specific:
1) Get the keys to the source and target spreadsheets. These are the long gobbledy-gook strings inside the URL that opens the sheet. If you see a URL like this: https://docs.google.com/spreadsheets/d/1fPvp5o2-xeH04STyeaoC_iJTy1JRGQZki3_j1l39wMQ/edit#gid=0, the ID of the sheet is the part after spreadsheets/d/ and before /edit. Place those keys in the code for sourceSs and destSs.
Open the target sheet. From the menu choose Tools -> Script editor. Assuming you've done nothing so far, you'll get a default "MyFunction()". Clear that text and copy/paste your code above, including the keys. Save the code. Close the code window, close the spreadsheet and reopen the target spreadsheet.
To actually update the values on the target spreadsheet, the user will be required to select the menu item "Refresh". The first time, the user will be required to authorize permissions to the script.
Give this a try. It's quite straightforward, once you know how.
New contributor
You need to do a few things, not hard but specific:
1) Get the keys to the source and target spreadsheets. These are the long gobbledy-gook strings inside the URL that opens the sheet. If you see a URL like this: https://docs.google.com/spreadsheets/d/1fPvp5o2-xeH04STyeaoC_iJTy1JRGQZki3_j1l39wMQ/edit#gid=0, the ID of the sheet is the part after spreadsheets/d/ and before /edit. Place those keys in the code for sourceSs and destSs.
Open the target sheet. From the menu choose Tools -> Script editor. Assuming you've done nothing so far, you'll get a default "MyFunction()". Clear that text and copy/paste your code above, including the keys. Save the code. Close the code window, close the spreadsheet and reopen the target spreadsheet.
To actually update the values on the target spreadsheet, the user will be required to select the menu item "Refresh". The first time, the user will be required to authorize permissions to the script.
Give this a try. It's quite straightforward, once you know how.
New contributor
New contributor
answered yesterday
Michael Ellis
112
112
New contributor
New contributor
File is not available by your link
– Boris Sokolov
yesterday
Boris, I only used that as a sample - I modified it intentionally to avoid giving away a real file from My Drive.
– Michael Ellis
yesterday
Ah... I thought it was a part of your sample :)
– Boris Sokolov
yesterday
add a comment |
File is not available by your link
– Boris Sokolov
yesterday
Boris, I only used that as a sample - I modified it intentionally to avoid giving away a real file from My Drive.
– Michael Ellis
yesterday
Ah... I thought it was a part of your sample :)
– Boris Sokolov
yesterday
File is not available by your link
– Boris Sokolov
yesterday
File is not available by your link
– Boris Sokolov
yesterday
Boris, I only used that as a sample - I modified it intentionally to avoid giving away a real file from My Drive.
– Michael Ellis
yesterday
Boris, I only used that as a sample - I modified it intentionally to avoid giving away a real file from My Drive.
– Michael Ellis
yesterday
Ah... I thought it was a part of your sample :)
– Boris Sokolov
yesterday
Ah... I thought it was a part of your sample :)
– Boris Sokolov
yesterday
add a comment |
김지민 is a new contributor. Be nice, and check out our Code of Conduct.
김지민 is a new contributor. Be nice, and check out our Code of Conduct.
김지민 is a new contributor. Be nice, and check out our Code of Conduct.
김지민 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53183751%2fhow-use-the-importrange-refresh-script%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
What have you tried so far?
– TheMaster
yesterday