2017-11-18 13:24
浏览 14


I use the asimlqt/php-google-spreadsheet-client to read google spreadsheets and to write in google spreadsheets.

There are functions to update and delete the actual worksheet but not to empty the worksheet before i write data in it.
Knows somebody who use this library a way to empty the worksheet before writing in? If not you can not be sure that old data is still available

图片转代码服务由CSDN问答提供 功能建议

我使用 asimlqt / php-google-spreadsheet-client 阅读谷歌电子表格并写入谷歌电子表格。 \ n

如果有人在写入之前使用这个库来清空工作表? 如果不是,您无法确定旧数据是否仍然可用

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dsai1991 2017-11-18 13:42

    My personal solution is delete the worksheet and recreate

    // service
    $spreadsheetService = new Google\Spreadsheet\SpreadsheetService();
    $spreadsheetFeed = $spreadsheetService->getSpreadsheetFeed();
    // retrieve a list of worksheets from a spreadsheet 
    $spreadsheet = $spreadsheetFeed->getByTitle('Spreadsheet');
    $worksheetFeed = $spreadsheet->getWorksheetFeed();
    // get the worksheet you want to empty
    $worksheet = $worksheetFeed->getByTitle('EmptySheet');
    // delete the worksheet
    // recreate the worksheet to be sure it's empty
    $spreadsheet->addWorksheet('EmptySheet', rows, column);


    Or use the batchUpdate with empty param userEnteredValue. Look at

    点赞 打赏 评论

相关推荐 更多相似问题