search

Home  >  Q&A  >  body text

How to add Google Sheets data to another Google Sheet using App Script

<p>Copy data from one Google sheet to another using appscript</p> <p>I want to display in another spreadsheet using appscript I want to add row and column data from one sheet to another using appscript. </p><p> Answer in the correct way, <code>your text</code>Don't make mistakes. </p>
P粉295728625P粉295728625490 days ago563

reply all(1)I'll reply

  • P粉388945432

    P粉3889454322023-08-11 10:30:14

    Copy data from one spreadsheet to another

    function copydata() {
      const ss = SpreadsheetApp.getActive();
      const ss1 = SpreadsheetApp.openById(gobj.globals.test1id);//替换为id
      const sh1 = ss1.getSheetByName("Sheet1");
      const vs1 = sh1.getDataRange().getValues()
      const ss2 = SpreadsheetApp.openById(gobj.globals.test2id);//替换为id
      const sh2 = ss2.getSheetByName("Sheet1");
      sh2.clearContents();
      sh2.getRange(1,1,vs1.length,vs1[0].length).setValues(vs1);
    }

    reply
    0
  • Cancelreply