Reputation: 1
I want to automate the import, but how to write a custom function to fetches the data, and writes it to the spreadsheet. this my app scrip `function myFunction() { var sheetName = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1"); //var queryString = Math.random; var cellFunction = '=IMPORTHTML("https://www.bybit.com/user/assets/order/derivatives/uniform-usdt/all-orders","table",1)';
sheetName.getRange('A1').setValue(cellFunction);your text
}`
but how i set the id and password automatic update google sheet every hour to get data from the website
Upvotes: 0
Views: 433
Reputation: 21
function getData() {
var websiteUrl = 'YOUR_WEBSITE_URL';
var loginCredentials = {
'username': 'YOUR_USERNAME',
'password': 'YOUR_PASSWORD'
};
var requestOptions = {
'method': 'post',
'payload': loginCredentials
};
var response = UrlFetchApp.fetch(websiteUrl, requestOptions);
var content = response.getContentText();
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
sheet.getRange(1, 1, data.length, data[0].length).setValues(data);
}
getData();
Hey, I really don't know what you are trying to do, so I have provided 2 ways to do the same but I would prefer that you refer to the Google Developers website while integrating it into your code. The above code will require some tries before it works fine.
https://developers.google.com/sheets/api/quickstart/js https://developers.google.com/sheets/api/quickstart/nodejs
Follow these steps and hopefully, you will get your answer.
Upvotes: 0