简体   繁体   English

如何使用Google表格API在JavaScript中创建包含两个表格的Google电子表格?

[英]How Can I create a Google spreadsheet with two sheets in javascript using Google sheets API?

I'm trying to create a Google Spreadsheet with two sheets or 'tabs' Using javascript. 我正在尝试使用javascript创建带有两个表格或“标签”的Google Spreadsheet。 I can Create a sheet and add a title to a tab, but I can only create one tab. 我可以创建一个工作表并为一个标签添加标题,但是我只能创建一个标签。 I have tried to use the addSheet property as well and it simply over-writes existing sheet. 我也尝试使用addSheet属性,它只是覆盖现有的工作表。 This is the data I'm trying to send as an example: 这是我尝试发送的数据,例如:

var data = {
  properties: {
    title: 'Data Sheet'
  },

  sheets: [{
    properties: {
      title: 'data A',
    },
    properties: {
      title: 'data B',
    }

  }]
};

I was missing additional brackets around my data. 我在数据周围缺少其他括号。 Simple mistake: 简单错误:

var data = { properties: { title: 'Data Sheet' }, var data = {属性:{title:'数据表'},

                    sheets : [
                        {
                            properties: {
                                title: 'data A',
                            }
                        },
                        {
                            properties: {
                                title: 'data B',
                            }
                        }
                    ]
                };

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Google表格API + Javascript更新电子表格 - How to update spreadsheet using Google Sheets API + Javascript 如何在 React 中使用 Google 表格 api 动态获取电子表格中的表格列表? - How do I get list of sheets in a spreadsheet dynamically with google sheets api in React? 使用Google Sheets API V4 API密钥创建电子表格 - Create spreadsheet with Google Sheets API V4 API Key Google Sheets Api:复制谷歌电子表格 - Google Sheets Api: Copy google spreadsheet 如何通过Google云端硬盘Javascript OAuth2 API创建Google表格文档? - How do I create a Google Sheets document via the Google Drive Javascript OAuth2 API? 如何在 Javascript 中使用 Google 表格 API 获取 sheetId? - How to get sheetId with Google Sheets API in Javascript? 如何使用javascript在谷歌表格中创建图表? - How to create chart in google sheets with javascript? 如何将此调用缓存到 Google 表格 API? - How can I cache this call to the Google Sheets API? 如何在不设置环境变量的情况下在 Javascript 中对 Google Sheets API 进行身份验证? - How can I authenticate into Google Sheets API in Javascript without setting environment variables? 如何在一个Google表格电子表格中的多个列范围上运行隐藏/显示列脚本? - How can I run my hide/show columns script on multiple ranges of columns in one google sheets spreadsheet?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM