简体   繁体   English

Google脚本编辑器-将多个Csv文件导入为多个电子表格

[英]Google Script Editor - Import multiple Csv files as multiple spreadsheets

I have 90 csv files in my Google Drive Id like to import into 90 distinct Google spreadsheets. 我的Google云端硬盘ID中有90个csv文件,想导入90个不同的Google电子表格中。

I used this tutorial to import 1 csv to 1 spreadsheet, but would it be possible to script import for my 90 files ? 我使用本教程将1个csv导入1个电子表格,但是可以对90个文件进行脚本导入吗?

For this you can loop the same code for all files. 为此,您可以为所有文件循环使用相同的代码。

  1. You have to make changes in this following line: 您必须在以下几行中进行更改:

    function convertRangeToCsvFile_(csvFileName) { // Get the selected range in the spreadsheet var ws = SpreadsheetApp.getActiveSpreadsheet().getActiveSelection(); function convertRangeToCsvFile_(csvFileName){//获取电子表格中的选定范围var ws = SpreadsheetApp.getActiveSpreadsheet()。getActiveSelection();

to get the range of each sheet by name. 以按名称获取每个工作表的范围。

  1. Also save the filenames for the csv files and loop through them. 还要保存csv文件的文件名并循环浏览。

Hope that helps! 希望有帮助!

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM