小编Rob*_*279的帖子

使用脚本将 csv 文件导入谷歌表格

我面临以下问题。我将看到一个 .csv 文件,其中包含以下字段:

ItemID  Date    Source name Title   URL Created ItemSourceType
Run Code Online (Sandbox Code Playgroud)

但是,我不需要所有字段,但我需要将其导入到预定义的 Google 表格模板中,如下所示:

Date    Writer  Status  Geog/Area/Product   Source  Title   Note
Run Code Online (Sandbox Code Playgroud)

同样,并非所有列都需要填充,因此最终解决方案应如下所示。

Date    Writer  Status  Geog/Area/Product   Source  Title   Note 
Today() NULL    NULL    Null                Site    Title-(hyperlinked with URL)   Null
Run Code Online (Sandbox Code Playgroud)

我已将以下代码放在一起 - 其中一些代码一直在测试并试图拆分出一个 CSV,我还没有尝试添加超链接字段。

function addData() {
  var fSource = DriveApp.getFolderById('138ZRbesgDkKHOROm4izD22oaXoanvsyJ'); // reports_folder_id = id of folder where csv reports are saved
  var sheet = SpreadsheetApp.getActiveSheet();
  var startRow = 12;  // First row of data to process
  var numRows = 2;   // …
Run Code Online (Sandbox Code Playgroud)

google-apps-script

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

google-apps-script ×1