Move A Row to Different Spreadsheet - Google Apps Script Tutorial

Поділитися
Вставка
  • Опубліковано 27 січ 2025

КОМЕНТАРІ • 15

  • @laganjsl5817
    @laganjsl5817 10 місяців тому +1

    Hello Sir, thanks for this tutorial video, but i have an issue, why data thats been moved to target sheet becomes duplicate? im following all way that you show on video

    • @SheetsNinja
      @SheetsNinja  10 місяців тому

      Typically if you have an issue with duplicates, it's when multiple edits are being made to the sheet, and so the script is running multiple times at the essentially same time. If there are multiple people in the Google Sheet at the same time, you might have to take a different approach and run a script at night to make the necessary transfers.
      Otherwise another approach is to use a script lock so its only running one at a time, but if you have multiple people making edits at the same time, this can also result in some weird and unexpected behavior.

  • @ItzelZarate-d1b
    @ItzelZarate-d1b Рік тому +1

    Hey there, what happens if you make a mistake and want to get the row back to the master list?

    • @SheetsNinja
      @SheetsNinja  Рік тому +1

      You'd have to add the script to the sheet it got moved to as well, and then basically take the same action on the target sheet

    • @ItzelZarate-d1b
      @ItzelZarate-d1b Рік тому

      @@SheetsNinja thanks for the prompt response!

  • @MireyaMarquez-b9u
    @MireyaMarquez-b9u 2 місяці тому

    Hello Sir,
    I have been having difficulties trying to get this script to work properly.
    I type it out exactly the same way you show it here on the video and I continue to receive an Error stating
    TypeError : Cannot read properties of undefined (reading 'range')
    Please HELP!!!

    • @SheetsNinja
      @SheetsNinja  2 місяці тому

      When you authorize the script or run it manually from the script editor, you will get that error, the question is if the function is now working on the spreadsheet?

    • @MireyaMarquez-b9u
      @MireyaMarquez-b9u 2 місяці тому

      @@SheetsNinja No unfortunately the function is still not working on the spread sheet.

  • @dnaml168
    @dnaml168 Рік тому

    HI, I want to ask you if I want to copy to other sheet , but keep old data

    • @SheetsNinja
      @SheetsNinja  Рік тому +1

      All you do is remove the line of code that says:
      sheet.deleteRow(row);

  • @JosephJericoMarino
    @JosephJericoMarino 6 місяців тому

    I have an error, the let range = e.range;
    TypeError: Cannot read properties of undefined (reading 'range')

    • @SheetsNinja
      @SheetsNinja  6 місяців тому

      That will happen when you authorize the script, because the onEdit is designed to run when the spreadsheet is edited and then "e" will contain info about the edit event that caused it to run. So the script should run now if you make an edit in the Google Sheet.

    • @mahdiNJR13
      @mahdiNJR13 5 місяців тому

      add trigger

  • @prakashshrestha3430
    @prakashshrestha3430 Рік тому

    hello sir, i have problem to move data on protected sheet and last data move to top in next sheet so please help me.

    • @SheetsNinja
      @SheetsNinja  Рік тому

      So if you don't have edit access to a sheet or tab, all you can do is copy data, not move it. If you want to copy the last row from a tab and move to the top of the next sheet, you'll just want to use this:
      let data = sourceSheet.getRange(sourceSheet.getLastRow(),1,1, sourceSheet.getLastColumn()).getValues();
      targetSheet.insertRowBefore(2)
      targetSheet.getRange(2,1,1,data[0].length).setValues(data);