I need help figuring out how to make a new empty Google Spreadsheet through the Drive API. I was looking at the old documentation that mentioned using DocumentsList API but that one doesn’t work anymore since it got discontinued. Now I’m supposed to use the Drive API instead but I can’t find clear instructions on creating blank spreadsheets with just the basic metadata. The documentation seems confusing and I’m not sure what endpoints or methods I should be calling. Has anyone successfully done this before? I just want to create a completely empty sheet file that I can work with later. Any code examples or step by step guidance would be really helpful.
What got me at first - you don’t need the Sheets API to create the file. Drive API creates it, then you can use Sheets API later for content. Keep the request body simple: just name and mimeType. I screwed up by adding spreadsheet properties during creation, which threw errors. Drive API sees Google Sheets like any other file, so don’t overcomplicate it. Once it’s created, you get back a spreadsheet ID that works as both the Drive file ID and Sheets document ID.
yeah, mimeType is everything here - ‘application/vnd.google-apps.spreadsheet’ tells Drive what file type to create. I kept hitting 400 errors until I figured out I was missing the content-type header. also, handle the response right - the file gets created but sometimes takes a moment to appear in Drive.
Use the Drive API’s files.create method to make a blank Google Spreadsheet. Set mimeType to ‘application/vnd.google-apps.spreadsheet’ and add basic metadata like the spreadsheet name. When I tried this, most examples I found were about uploading files, not creating new Google Workspace docs. You’re just telling Google Drive to create a new spreadsheet - no file upload needed. Make sure your OAuth scope includes ‘https://www.googleapis.com/auth/drive.file’ so you can create files. Once it runs, you’ll get back a file ID that works with the Sheets API for adding data.