Encountered a problem while attempting to convert column chart to 3D using Google Sheets API

I've encountered a problem while attempting to convert all column charts in my spreadsheet to 3D column charts. Despite following Google's documentation, I receive an error message when running the code below.

Could this be an issue with the API? Or is there an error in my code?


function threeDCharts(){
     var sheet = SpreadsheetApp.getActiveSpreadsheet();
     var sheetID = sheet.getId();
  
     var charts = sheet.getSheetByName("Data").getCharts();

     var ids = [];
     var requests = [];

     for(i=0;i<charts.length;i++){
        ids.push(charts[i].getChartId())
     }
     for(i=0;i<charts.length;i++){
        requests.push({"updateChartSpec":{
           "chartId": ids[i],"spec":{
               "basicChart": {
                   "chartType": "column", "threeDimensional":true
                }
            }
         }});
     }

     var resp = Sheets.Spreadsheets.batchUpdate({requests:requests}, sheetID);
  }

The exact error message reads as follows:

GoogleJsonResponseException: API call to sheets.spreadsheets.batchUpdate failed with error: Invalid requests[0].updateChartSpec: chartSpec.basicChart.threeDimensional not supported when chartSpec.basicChart.chartType is COLUMN.

The "threeDimensional" attribute should work according to Google's documentation at the link provided below.

Edit for clarity:

Attached is a sample spreadsheet illustrating the issue.

Another part of my script will generate two column charts based on the averages calculated by the spreadsheet from individual measurements.

The function mentioned earlier locates all charts in the sheet and updates them using an updateChartSpec request to switch the column charts to the "3D" format.

Measurement Sample A Sample B Sample C

Click here to see the expected transformation from the left chart to the right chart

Answer №1

Based on the image you provided, I can grasp your current scenario.

Upon setting the column chart as 3D manually and retrieving the chart object using Sheets.Spreadsheets.get from Sheets API, it is evident that threeDimensional is set to true.

However, when attempting to update threeDimensional to true in the request body of updateChartSpec under batchUpdate, an error message such as

chartSpec.basicChart.threeDimensional not supported when chartSpec.basicChart.chartType is COLUMN.
pops up.

Even if addChart is employed with threeDimensional: true, the same error persists.

By changing threeDimensional: true to threeDimensional: false in the request body, the error disappears.

This situation suggests a potential bug at the current stage. Hence, I recommend reporting this issue to the Google issue tracker via https://developers.google.com/issue-tracker since no relevant information was found during my search.

References:

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to implement <li> in place of <div> to ensure the tool-tip code functions properly?

To see an example, please refer to this fiddle: http://jsfiddle.net/66nLy/12/ I am looking to achieve a similar functionality on a webpage, but using <li> instead of <div>. Here is the HTML code snippet: <table class="base-table selection- ...

show additional worth on the console

Just starting out with JavaScript. Trying to display additional values in the console. Uncertain about how to access add-ons. Can anyone help me troubleshoot? Here is my code snippet below: https://jsfiddle.net/6f8upe80/ private sports: any = { ...

The Three JS on the website is error-free, yet it fails to function properly

I've been attempting to replicate the example three.js page on my own website, complete with a canvas for the 3D animation. However, I'm encountering an issue where nothing is displayed, despite no errors appearing. I've tried troubleshootin ...

Why is My TensorFlow.js Model for Predicting 2 Table Multiples Not Producing Accurate Results?

I have created a tensorflow.js model that predicts outputs in multiples of two. For example, if the input is 16, the prediction should be 32. However, even after providing the input data and labels accordingly, the output printed is [[1],] after prediction ...

In NodeJS, inserting array objects into GraphQL is prohibited

Encountering an issue while trying to insert array objects. Below is the code snippet: GraphQL Schema type Member { _id: ID! member_id: Int! first_name: String! last_name: String username: String date: String } input MemberInput { member_i ...

Issue with padding in Material UI button component not being applied as expected

I am struggling with applying padding and styles to my Material UI component. Take a look at the code snippet below: import "./css/Landing.css"; import { Button } from "@mui/material"; function Landing() { return ( <div class ...

How to execute a function in store.js from a different JS file within a Vue project

I am currently utilizing Vuex to store my data in a file called store.js. Within this setup, I have a mutation method named 'autoUpdateDb' as seen below: store.js : import Vuex from "vuex"; import Vue from "vue"; import { ser ...

The output for each function is consistently the same for every record

Implementing a foreach loop to send data and display it in the success function of an AJAX call is functioning smoothly. Recently, I made a modification to the code by introducing a new data-attribute which contains the $creator variable. Here's how ...

What steps should be taken once the idToken in Firebase has expired?

My code is utilizing the onAuthStateChanged function: this.unregisterAuthObserver = firebase.auth().onAuthStateChanged(user => { if (user) { user.getIdToken(true).then((idToken) => { console.log(user) ... }); } After the idT ...

Transform the features of a website into a sleek iOS application using Swift

Can I take an HTML website coded with JavaScript and integrate its functionality into my app using WebKit or another method? By using WebKit or WebViews, I can load an entire webpage into my app, automatically bringing along its functionality. However, i ...

Tips for toggling the visibility of a <div> element with a click event, even when there is already a click event assigned

No matter what I try, nothing seems to be working for me. I'm looking to hide the <div id="disqus_thread"> at first and then reveal it when I click on the link "commenting", after the comments have loaded. This particular link is located at the ...

Perform queries securely using AJAX when the document is fully loaded

Hello everyone, I'm facing an issue with the custom statistics feature on my website. I collect user data (similar to Google Analytics) and store it in tables for a few months. However, these tables have become too large and are causing slow page loa ...

Meteor application: The correct method for fetching a single document from a collection on the client side

Currently in my meteor app, I am saving the unique id of the client within a collection named UserNavigationTracker: { "clientId" : "xxNfxxPGi7tqTbxc4", "currentWizard" : "IntroductionWizard", "currentStep" : "Step-1", "_id" : "ifBJ688upEM ...

"Learn how to extract the image URL from the configuration file (config.json) within the assets folder, and then seamlessly display it within

In my Angular project, I have a configuration file located in the assets folder: { "brandConfig": "brand1", "brand1": {"urlPath": "http://192.168.168.60:8081/mantle-services", " ...

There seems to be a column in the MySQL INSERT query that is unidentifiable and does not exist in the list of fields

id and cost are required as integers and cannot be left empty. I encountered the following error message: 'Error: ER_BAD_FIELD_ERROR: Unknown column 'undefined' in 'field list'' var sql = "INSERT INTO Paintings(` ...

Django Ajax filter displaying issue on HTML page

I'm uncertain about the correctness of my Ajax implementation. When using Django's built-in tags, the objects I pass through Ajax are not appearing on my template HTML page. view_results.html <div> <input id="search" name="search" t ...

AngularJS Uncaught ReferenceError: variable is not

I am facing an issue where I cannot retrieve a value from a function. I am performing REST requests for testing purposes and when trying to get a date, it always returns undefined. An Illustration $http.get('app/components/home/controller/test_calen ...

"Enhance Your Website with a Custom Contact Form using Bootstrap, jQuery Validation

I am currently working on integrating a straightforward Bootstrap contact form with AJAX and jQuery validation. Despite being close to the desired outcome, there are a few issues that I cannot seem to resolve. The form validates input fields (although I ai ...

The process of altering the color of a table row in JavaScript can be done after dismissing a pop-up that was triggered by a button within the same row

I am tasked with changing the color of a specific table row based on user interaction. The table consists of multiple rows, each containing a button or image. When the user clicks on one of these buttons or images, a popup appears. Upon successful data sub ...

Discover how to sum all the elements at a specific index within a JavaScript array using Vue.js

I am working on a project where I have created an array of products to display using VueJS. Each time a user selects a product, it is added to a list and the "Count" value increments. The "Total Price" for each product is calculated by multiplying the "C ...