1

I am looking to get a list of all slide titles and respective slide numbers from an existing slide deck of 50+ slides.

I have looked at this question however it has been posted a couple of years ago and doesn't work any more.

I am grateful for any guidance on how to get started on solving this problem.

CertainPerformance
  • 356,069
  • 52
  • 309
  • 320
Mishal
  • 450
  • 9
  • 27
  • In order to correctly understand about your goal, can you provide the sample Slides and the output values you expect? Of course, please remove your personal information. And also, can I ask you about the detail information of `however it has been posted a couple of years ago and doesn't work any more.`? – Tanaike Feb 15 '20 at 01:49
  • Hi @Tanaike for example if I have 5 slides with a title that says A, B, C, D, E and the respective slide numbers are 1, 2, 3, 4, 5 - the on running the script I have two columns on a spreadsheet that give the title and respective slide number. Does that make sense? – Mishal Mar 13 '20 at 18:55
  • Thank you for replying. I noticed that an answer has already been posted. I think that it will resolve your issue. – Tanaike Mar 13 '20 at 23:51
  • Hi @Tanaike when I used the below - I get the following error ```Exception: Object is not of type Shape. (line 8, file "Code")``` would you know how to resolve this? – Mishal Mar 14 '20 at 10:49
  • Thank you for replying. I think that the answerer might be thinking the solution now. So how about waiting for the answere's response? – Tanaike Mar 14 '20 at 23:22

1 Answers1

2

Is this what you are looking for?

function somethingWithSlides(){

var slidesArray = [];

var presentation = SlidesApp.openById("XXXXX");

var slidesLength = presentation.getSlides().length;
var slidesTitles = presentation.getSlides().map(function(slide){return slide.getPageElements()[0].asShape().getText().asString()});
var slidesIds = presentation.getSlides().map(function(slide){return slide.getObjectId()});

  for(var i=0;i<slidesLength;i++){
    slidesArray.push([slidesTitles[i],slidesIds[i]]); 
  }

return slidesArray; 

}

If not, sorry.

timmer
  • 159
  • 6
  • Thanks @timmer for your quick response. I am getting the below error on running the code ```Exception: Object is not of type Shape. (line 8, file "Code")``` Would you know what this means? – Mishal Mar 13 '20 at 18:52