Here is a solution that should resolve your use case.

Keep in mind, there are still limitations one cannot exceed, you can read more about it here. For example, getInboxThreads() will fail when the size of all threads is too large for the system to handle. This is most likely what happened in your solution.

Instead, try to use getInboxThreads(start, max) this will retrieves a range of Inbox threads irrespective of labels. So, the code should now look something like this assuming you have 500+ emails. It is not elegant but it works.

function getMail(){
 var myspreadsheet = SpreadsheetApp.openById('xxxxxxxxxxxxxxxxxxxxxx');
 var mysheet = myspreadsheet.getSheets()[0];

 var start = 0;
 var max = 99;
 var count =0;
 var row = mysheet.getLastRow()+1
 while(count < 7) 
 {

   var threads = GmailApp.getInboxThreads(start , max);
   var messages = GmailApp.getMessagesForThreads(threads); 
   var froms = [];
    messages.get
      for(var i = 0; i < threads.length; i++)
    {
       froms.push([messages[i][0].getId(),messages[i][0].getSubject()]);
    }

    mysheet.getRange(mysheet.getLastRow()+1,1,threads.length,2).setValues(froms);

    start =  start + 100;
    count++;
    }
}

Reminder: Script runtime cannot exceed more than six minutes, if so the script will throw an exception.

Hope this helps and Good luck!