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 8574963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:35:30+00:00 2026-06-11T19:35:30+00:00

I use the Google Chart Service to create a table in Google Apps Script

  • 0

I use the Google Chart Service to create a table in Google Apps Script for my web app.
Now I have 2 problems:

  1. When I add more rows and columns, The columns’ width is getting smaller until the point were scrollbars appear. I added a code example. Can I change/increase the (maximum) displayed size of the chart, so that there are no scrollbars?

  2. I need a string-column, which is aligned to the right. The default is a aligned to the left for string columns. How can I change this? And are there more options to modify the format of the table (text size, colors, bold etc.)?

    function doGet() {
    var app = UiApp.createApplication();
    
    var data = Charts.newDataTable()
    .addColumn(Charts.ColumnType.STRING, "Name")
    .addColumn(Charts.ColumnType.STRING, "Gender")
    .addColumn(Charts.ColumnType.NUMBER, "Age")
    .addColumn(Charts.ColumnType.NUMBER, "Donuts eaten")
    .addColumn(Charts.ColumnType.NUMBER, "Donuts eaten")
    .addColumn(Charts.ColumnType.NUMBER, "Donuts eaten")
    .addColumn(Charts.ColumnType.NUMBER, "Donuts eaten")
    .addRow(["Michael", "Male", 12, 5])
    .addRow(["Michael", "Male", 12, 5])
    .addRow(["Elisa", "Female", 20, 7])
    .addRow(["Robert", "Male", 7, 3])
    .addRow(["John", "Male", 54, 2])
    .addRow(["Jessica", "Female", 22, 6])
    .addRow(["Aaron", "Male", 3, 1])
    .addRow(["Margareth", "Female", 42, 8])
    .addRow(["Miranda", "Female", 33, 6])
    .addRow(["Miranda", "Female", 33, 6])
    .addRow(["Miranda", "Female", 33, 6])
    .addRow(["Miranda", "Female", 33, 6])
    .addRow(["Miranda", "Female", 33, 6])
    .addRow(["Miranda", "Female", 33, 6])
    .build();
    
    var tableChart = Charts.newTableChart().setDataTable(data)
    .build();
    
    app.add(tableChart);
    
    return app;
    }
    
  • 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-06-11T19:35:31+00:00Added an answer on June 11, 2026 at 7:35 pm

    About p.1. There are two ways to change a chart width and height. The 1st one is to use the setDimensions method of the TableChartBuilder class. A disadvantage of this method is that impossible to set width/height in the page width/height percentage. The 2nd way is to use the setOption methof of the same class. This method has no the disadvantage. The following code demonstrates it.

    About p.2. Unfortunately, now it is not possible to align columns of the Table Chart. As far as I know it is even impossible to align columns of the GWT Table which is under the hood of the Table Chart. You are free to create a feature request on the GAS issue tracker about this lack.

    function doGet() {
    var app = UiApp.createApplication();
    
    var data = Charts.newDataTable()
    .addColumn(Charts.ColumnType.STRING, "Name")
    .addColumn(Charts.ColumnType.STRING, "Gender")
    .addColumn(Charts.ColumnType.NUMBER, "Age")
    .addColumn(Charts.ColumnType.NUMBER, "Donuts eaten")
    .addColumn(Charts.ColumnType.NUMBER, "Donuts eaten")
    .addColumn(Charts.ColumnType.NUMBER, "Donuts eaten")
    .addColumn(Charts.ColumnType.NUMBER, "Donuts eaten")
    .addRow(["Michael", "Male", 12, 5])
    .addRow(["Michael", "Male", 12, 5])
    .addRow(["Elisa", "Female", 20, 7])
    .addRow(["Robert", "Male", 7, 3])
    .addRow(["John", "Male", 54, 2])
    .addRow(["Jessica", "Female", 22, 6])
    .addRow(["Aaron", "Male", 3, 1])
    .addRow(["Margareth", "Female", 42, 8])
    .addRow(["Miranda", "Female", 33, 6])
    .addRow(["Miranda", "Female", 33, 6])
    .addRow(["Miranda", "Female", 33, 6])
    .addRow(["Miranda", "Female", 33, 6])
    .addRow(["Miranda", "Female", 33, 6])
    .addRow(["Miranda", "Female", 33, 6])
    .build();
    
    var tableChart = Charts.newTableChart().setDataTable(data);
    
    //tableChart.setDimensions(1200, 100); // Uncomment this line if you wish to set dimentions in pixels.
    tableChart.setOption('width', '100%');
    tableChart.setOption('height', '100%');  
    
    
    app.add(tableChart.build());
    
    return app;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use Google Chart API to build chart's in my app. In my case
I have a PHP-page with a series of pie chart images (I use Google
I've been trying to figure out how to use google chart-wrapper with my django
I am trying to use the google chart tools (from the visualization api; not
I use Google Visualization API to plot Line Chart. Here are the codes: google.load(visualization,
I'm trying to use a google visualisation, the column chart, inside an asp.net AJAX
I use Google free gadgets in my web site . every thing goes okay
I am trying to use Google App Engine's app.yaml to automatically serve *.html files
I want to use Google Chart API using javascript. (I don't want to use
Can anyone tell me if they know how to use the Google Chart API

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.