Search code examples
google-apps-scriptgoogle-app-maker

Is there any way to convert a a large Excel CSV file to Google Sheet in Google App Maker?


In my Google App Maker application, I am trying to convert a large, user-uploaded Excel CSV file to Google Sheet. I have previously used these lines of code to convert smaller-size, user-uploaded Excel CSV files to Google Sheets:

     var xlsxBlob = DriveApp.getFileById(xlsxFileID).getBlob();
     var file = {
     };
     file = Drive.Files.update(file, ssFileID, xlsxBlob, {
       convert: true
     });

When I try uploading a large Excel CSV file, I get this error:

     Exception: File NAME.csv exceeds the maximum file size

My Excel CSV file is 56.5 MB. Is there any way to convert a large Excel CSV file to Google Sheet? I tried following this website: https://www.geek.com/apps/geek-101-how-to-open-a-csv-document-with-google-docs-1551489/ which converts a CSV file to Google Sheet immediately upon upload. However, I get an error: Upload failed. Thank you very much!


Solution

  • You probably have to break your csv into smaller chunks. Also, if the number of fields in the csv file is in excess of 2 million cells then you have another problem on your hands since a google sheet's max cell count is 2 million.

    Google Sheets are not designed to handle large databases so you may have to look into using an alternative solution; if you plan on keeping your dev stack under Google's Cloud platform you can try Big Query, Cloud SQL, Cloud Datastore or Cloud Firestore.