在WordPress页面上显示Google电子表格中的值 [英] Displaying values from a Google spreadsheet on a WordPress page
问题描述
I have followed the tutorial on this website https://www.wp-tweaks.com/display-a-single-cell-from-google-sheets-wordpress/ which allows to dynamically display values from a Google spreadsheet on a WordPress page using a simple shortcode:
[get_sheet_value location="Cell Location"]
该解决方案可以无缝运行,直到单个页面包含数百个短代码为止(我基本上需要页面的整个内容都可以通过电子表格进行编辑).我开始通过API方法(基于Google指标)收到100%的错误,并且内容无法再正确显示.我意识到,在每次加载页面后发送数百个读取请求不是理想的选择,这将不可避免地影响加载性能,并且Google也设置了配额限制.有没有办法绕过这个问题?例如,每天仅一次从Google电子表格中提取值.不幸的是,我没有太多的编码经验,但是我愿意接受所有解决方案.预先感谢!
This solution worked seamlessly until a single page contained hundreds of those shortcodes (I basically need the whole content of the page to be editable via the spreadsheet). I started getting 100% Errors by API method (based on the Google Metrics) and the content was not displayed properly anymore. I realize that sending hundreds of read requests after each page load is not ideal and will inevitably affect the load performance and that Google imposes quota limits too. Is there a way to bypass this issue? For example by pulling the values from the Google spreadsheet only once a day. Unfortunately, I don't have much coding experience but I'm open to all solutions. Thanks in advance!
推荐答案
您可以发布将该表格投放到网络上,并将其嵌入到您的网站中:
You could publish the sheet to the web and embed it to your website:
- 在工作表中,转到文件>发布到网络上
- 在出现的窗口中,点击嵌入.
- 点击发布.
- 将代码复制到文本框中,然后将其粘贴到您的网站中.
- 要显示或隐藏电子表格的各个部分,请在您的网站上编辑HTML.
它看起来像这样(单击运行代码"片段):
It would look like this (click on Run code snippet):
<iframe src="https://docs.google.com/spreadsheets/d/e/2PACX-1vR3UbHTtAkR8TGNtXU3o4hzkVVhSwhnckMp7tQVCl1Fds3AnU5WoUJZxTfJBZgcpBP0VqTJ9n_ptk6J/pubhtml?gid=1223818634&single=true&widget=true&headers=false"></iframe>
这篇关于在WordPress页面上显示Google电子表格中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!