Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7664321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:16:37+00:00 2026-05-31T14:16:37+00:00

I have a google spreadsheet with multiple columns that have variable row counts in

  • 0

I have a google spreadsheet with multiple columns that have variable row counts in each column. I would like to combine all the columns into one column.

So if the following is the data:
Column 1, column 2, Column 3, Column 4
Row 1: A, B, C, D
Row 2: ,,,E

I would want to get
Row 1: A
Row 2: B
Row 3: C
Row 4: D
Row 5: E

I would like this to be non-destructive to the original sheet so it should create a new spreadsheet tab with a unique name. The unique name is important b/c i would like to run this function on multiple spreadsheets that are all different. The unique name will avoid overlap.

The request is to help me write the script to do this transpose in google apps spreadsheets

Thank you for the help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T14:16:38+00:00Added an answer on May 31, 2026 at 2:16 pm

    Here is the script, please let me know if you encounter any issues, at the moment it ignores blank cells and the value “0”.

    function myFunction() {
      var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
      var sheet1 = spreadsheet.getSheets()[0];
      var lastRow = sheet1.getLastRow();
      var lastColumn = sheet1.getLastColumn();
      var values = sheet1.getRange(1, 1, lastRow, lastColumn).getValues();
      var d = new Date();
      var newSheet = spreadsheet.insertSheet("Sheet: "+d.getTime());
      var counter=1;
      for (var i=0;i<=lastRow-1;i++) {
        for (var j=0;j<=lastColumn-1;j++) {
          if(values[i][j]!="") {
            newSheet.getRange(counter,1).setValue(values[i][j]);
            counter++;
          }
        }
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Google Spreadsheet with 3 columns that are either blank or have
I would like to create a HLOOKUP in google doc spreadsheet: =HLOOKUP(aValue;DEC10!$D$2:$W$3;2;FALSE) I have
I have a form that fills in a Google Spreadsheet. One of the columns
I have a google spreadsheet that uses this function: =SUM(E:E) - SUM(C:C) It adds
I have a Google Sheets of the translations of all my strings.xml resources. Each
I'm new to Google Documents and have set up a spreadsheet that accesses the
I have a web app for commercial property management that needs spreadsheet-like functionality for
This is a script I have for a google spreadsheet. It all works except
I have an app that uses a google spreadsheet to populate a menu and
I have three scripts that are in a google docs spreadsheet. In this spreadsheet,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.