macMikey / 4d-google-workspace

manage google docs and sheets
Other
4 stars 2 forks source link

create a spreadsheet document #28

Open macMikey opened 1 year ago

macMikey commented 1 year ago

creating a sheet should be simple, right? I found the following: Create a spreadsheet which uses the create method - but i'm not sure if that url is helpful, because it's calling javascript.

But, it's not that simple, either - you can't create one where you want it, you have to move it

The http request is just POST https://sheets.googleapis.com/v4/spreadsheets, which implies that you don't even call create

macMikey commented 1 year ago

POST https://sheets.googleapis.com/v4/spreadsheets

The body contains a spreadsheet object

{
  "spreadsheetId": string,
  "properties": {
    object ([SpreadsheetProperties](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#SpreadsheetProperties))
  },
  "sheets": [
    {
      object ([Sheet](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#Sheet))
    }
  ],
  "namedRanges": [
    {
      object ([NamedRange](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#NamedRange))
    }
  ],
  "spreadsheetUrl": string,
  "developerMetadata": [
    {
      object ([DeveloperMetadata](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.developerMetadata#DeveloperMetadata))
    }
  ],
  "dataSources": [
    {
      object ([DataSource](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#DataSource))
    }
  ],
  "dataSourceSchedules": [
    {
      object ([DataSourceRefreshSchedule](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#DataSourceRefreshSchedule))
    }
  ]
}
macMikey commented 1 year ago

manipulating the properties is ungreat for n00bs (and me in 4 weeks when i forget how to do this) should be easier to create and place the spreadsheet, to begin with