1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Create a list from Google Sheets difers if it is horizontal

Discussion in 'Business Applications' started by Zsolt Kükedi, Feb 11, 2018.

Thread Status:
Not open for further replies.
  1. Zsolt Kükedi

    Zsolt Kükedi Thread Starter

    Joined:
    Aug 25, 2004
    Messages:
    5
    Hi!

    I'd like to get a few cells in a list from a Google Sheets.
    I have the following data:
    First list horizontally: 1 in C2, 2 in D2, 3 in E2
    Second list vertically: 1 in C5, 2 in C6, 3 in C7
    Here is the test sheet: https://goo.gl/UDooqL

    I use the following script:

    function onEdit(){
    var tabla = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
    var aktivcella = tabla.getActiveCell();
    if(aktivcella.getColumn() == 1 && aktivcella.getRow() > 1){
    var vizszinteslista = tabla.getRange(2, 3, 1, tabla.getLastColumn()).getValues();
    var fuggolegeslista = tabla.getRange(5, 3, tabla.getLastRow(), 1).getValues();
    Logger.log(aktivcella.getValue());
    Logger.log(vizszinteslista);
    Logger.log(fuggolegeslista);
    tabla.getRange("E8").setValue("a script lefutott");
    }
    }

    This results in the log:

    [<<timestamp>>] Igen
    [<<timestamp>>]] [[1.0, 2.0, 3.0, , ]]
    [<<timestamp>>] [[1.0], [2.0], [3.0], [], [], [], []]

    Why the two list differs?

    Thanks.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1204718

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice