I'm a beginner
Is it possible to read the contents of Google spreadsheet into external HTML?
(Example: Place A1 in the spreadsheet in the HTML P tag)
I was able to find the document that you said you would load into the HTML of GAS.
I'm asking you a question because I can't find anything to read from the external HTML.
If possible, I would appreciate it if you could let me know
Thank you for your cooperation
html google-apps-script
Google spreadsheet content cannot be set directly to external HTML.
However, it is possible to:(Please change the settings in a timely manner)
The actual code will look like this:
GAS
var SHEET_NAME="Sheet 1";
function getValue() {
vars = SpreadsheetApp.openById(SpreadsheetApp.getActiveSpreadsheet().getId());
varsheet=ss.getSheetByName(SHEET_NAME);
return sheet.getRange("A1").getValue();
}
function doGet(e){
return ContentService.createTextOutput(getValue()) .setMimeType(ContentService.MimeType.TEXT);
}
JavaScript
#↑ copied URL
consturl="https://script.google.com/macros/s/xxxxxxxxxxx/exec"
fetch(url,{
method: "GET",
}).then(response=>response.text())
.then(text=>{
// Output retrieved value to console
console.log(text);
// Set the required values in HTML.
const targetID = "hoge";
document.getElementById(targetID).innerText=text;
});
You can hit the API on the server side even if it's not JavaSciplt.
If the server handles it in the first place, I think there is a way to go read the spreadsheet directly using Google API instead of using GAS.
(I'm not familiar with Java, but I think I can use the library Google-api-java-client.)
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
916 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.