Google表格-取消合并单元格并填写 [英] Google Sheets - Unmerge cells and fill down

查看:89
本文介绍了Google表格-取消合并单元格并填写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要拿一张由其他人维护的工作表,然后执行以下操作(以便我可以导出到csv):

I need to take a sheet maintained by someone else and do the following (so that I can export to a csv):

  • 取消合并所有单元格
  • 向下填充值
  • 合并的单元格在多列中,所以我需要遍历一个范围

手动完成任务太多,需要定期进行.我的JavaScript和Google表格对象模型知识大约为零,但是我知道这是可能的,因为我可以在VBA中做到这一点.我进行了搜索,但只能找到VBA/Excel的程序化答案.

It's too much to do it by hand, and it will need done periodically. My javascript and google sheets object model knowledge approximate zero, but I know it's possible because I could do it in VBA. I searched but can only find programmatic answers for VBA/Excel.

如何在Google表格中有效地做到这一点?

How can I do this efficiently in Google Sheets?

推荐答案

您可以使用 breakapart()

You can use the breakapart() class to do this. I am assuming that the merged range is not static and has multiple occurrences. This script will unmerge all merged ranges in the active sheet.

function myFunction() {
  var sheet = SpreadsheetApp.getActiveSheet();
  sheet.getRange(1, 1, sheet.getMaxRows(), sheet.getMaxColumns()).breakApart();
}

这篇关于Google表格-取消合并单元格并填写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆