Move A Row to Different Spreadsheet - Google Apps Script Tutorial

Поделиться
HTML-код
  • Опубликовано: 16 сен 2024
  • In this video, I quickly demonstrate and explain how to put together a Google Sheet and the App Script to be able to quickly move rows of data between tabs using a dropdown status.
    If you want to make a copy of the Google Sheet and script I used in the video, check it out here:
    bit.ly/3zaQiWk

Комментарии • 12

  • @laganjsl5817
    @laganjsl5817 6 месяцев назад +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  6 месяцев назад

      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 9 месяцев назад +1

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

    • @SheetsNinja
      @SheetsNinja  9 месяцев назад +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 9 месяцев назад

      @@SheetsNinja thanks for the prompt response!

  • @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);

  • @prakashshrestha3430
    @prakashshrestha3430 11 месяцев назад

    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  11 месяцев назад

      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);

  • @JosephJericoMarino
    @JosephJericoMarino Месяц назад

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

    • @SheetsNinja
      @SheetsNinja  Месяц назад

      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 Месяц назад

      add trigger