0

I'm trying to get the charts from a sheet as img. This is working fine on my personal gmail account. But when i try this test function in my Gsuite account (as admin) i get 0 charts (from 4)

I read some comments here that you need to share (with link). But this does not solve my issue. Anyone an idea?

EDIT: I added drive and sheets API to the services. But this does not solve the issue.

ISSUE EDIT: For information. This is a issue from google. Turns out i was testing with just the first chart that came up (column chart). But i was trying the get the SCORECARD. This is not possible right now..

https://issuetracker.google.com/issues/154996585

The test script:

function testCharts(){
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Chart");
const charts = sheet.getCharts();

console.log(charts.length);
console.log(charts[0].getRanges()[0].getA1Notation());

}
RemcoE33
  • 1,551
  • 1
  • 4
  • 11
  • Is this the same file you are accessing from both your personal and workspace account? – iansedano Feb 02 '21 at 10:01
  • @iansedano no there are both different and both are on there own drive. – RemcoE33 Feb 02 '21 at 18:37
  • I am not sure i understand. Can you add the steps so that I might be able to reproduce this on my own workspace account? Maybe its the specific file that is having problems, or even if you create a new file, add charts, the function still does not work? – iansedano Feb 03 '21 at 08:10
  • @iansedano This get me thinking, i created a brand new sheet in my 'personal' workspace drive (root) this works fine. But in root/sharedFolder is does not, and this is the case.. This narrows it down! I tested it in a teams drive and this works to. So only a drive folder that is shared outside the domain.. – RemcoE33 Feb 03 '21 at 18:39
  • @iansedano looks like my tpye of chart is messing it up: Scorecard chart – RemcoE33 Feb 03 '21 at 19:07

2 Answers2

0

Try this:

function testCharts() {
  const sheet = SpreadsheetApp.openById('use id of shared spreadsheet').getSheetByName("name of sheet in shared spreadsheet");
  const charts = sheet.getCharts();

  console.log(charts.length);
  console.log(charts[0].getRanges()[0].getA1Notation());

}
Cooper
  • 59,616
  • 6
  • 23
  • 54
  • thanks for your awnser. Unfortunately same result. On my personal account i did not even share the sheet and it is working. So it is a Gsuite related issue/configuration – RemcoE33 Feb 02 '21 at 18:41
0

For information. This is a issue from google. Turns out i was testing with just the first chart that came up (column chart). But i was trying the get the SCORECARD. This is not possible right now..

https://issuetracker.google.com/issues/154996585

RemcoE33
  • 1,551
  • 1
  • 4
  • 11