0

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

1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Nov 8, 2023 at 17:43

1 Answer 1

0
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.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks for helping, I'm trying to get my order history from an authentication website call bybit and auto store all my history to google sheet. I will try the ways that you provided. I really appreciate your help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.