Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 我试图在谷歌电子数据表上打印NSE印度网站表,但我无法得到它_Google Apps Script_Spreadsheet_Google Sheets Api_Spread - Fatal编程技术网

Google apps script 我试图在谷歌电子数据表上打印NSE印度网站表,但我无法得到它

Google apps script 我试图在谷歌电子数据表上打印NSE印度网站表,但我无法得到它,google-apps-script,spreadsheet,google-sheets-api,spread,Google Apps Script,Spreadsheet,Google Sheets Api,Spread,我试图在谷歌电子数据表上打印NSE印度网站表,但我无法得到它。 我在范围函数中面临的问题是,我需要传递哪些示例参数才能在google电子表格中获得此表 下面是我的代码 var cellFunction = '=IMPORTHTML("https://www.nseindia.com/live_market/dynaContent/live_watch/option_chain/optionKeys.jsp?symbolCode=-9999&symbol=BANKNIFTY&sym

我试图在谷歌电子数据表上打印NSE印度网站表,但我无法得到它。 我在范围函数中面临的问题是,我需要传递哪些示例参数才能在google电子表格中获得此表

下面是我的代码

var cellFunction = '=IMPORTHTML("https://www.nseindia.com/live_market/dynaContent/live_watch/option_chain/optionKeys.jsp?symbolCode=-9999&symbol=BANKNIFTY&symbol=BANKNIFTY&instrument=OPTIDX&date=-&segmentLink=17&segmentLink=17","table")';
sheetName.getRange('1','23','80','80').setValue(cellFunction);
如果要将单元格内容设置为公式,则需要使用而不是

您还只需将公式插入单个单元格,它将自动展开表中相邻单元格中的数据

试着替换

sheetName.getRange('1','23','80','80').setValue(cellFunction);

一个完整的工作示例是:

function insertFormula() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var range = sheet.getRange(1, 1); // inserts formula into A1
  range.setFormula('=IMPORTHTML("https://www.nseindia.com/live_market/dynaContent/live_watch/option_chain/optionKeys.jsp?symbolCode=-9999&symbol=BANKNIFTY&symbol=BANKNIFTY&instrument=OPTIDX&date=-&segmentLink=17&segmentLink=17";"table")');
}

@PKInception必须有足够的空闲单元格来插入表,请在空白工作表中尝试。
function insertFormula() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var range = sheet.getRange(1, 1); // inserts formula into A1
  range.setFormula('=IMPORTHTML("https://www.nseindia.com/live_market/dynaContent/live_watch/option_chain/optionKeys.jsp?symbolCode=-9999&symbol=BANKNIFTY&symbol=BANKNIFTY&instrument=OPTIDX&date=-&segmentLink=17&segmentLink=17";"table")');
}