Import picture from google sheets to WordPress
-
I am trying to get a picture from google sheets and show it on WordPress. Currently I can get the contents of the cell and display it on WordPress using shortcode, but it won’t show anything if there is an image in the cell. This is the plugins code that I made. `
function sheet_value_shortcode($atts) { $API = 'AIzaSyCraqgs12gUCy2asiXyvnPOaNd238bZ2k'; $google_spreadsheet_ID = '1DQ7JxN9P4C241uMxT-aMSjt4pZe0mObWtMUIixinU9'; $api_key = esc_attr( $API); $location = $atts['location']; $get_cell = new WP_Http(); $cell_url = "https://sheets.googleapis.com/v4/spreadsheets/$google_spreadsheet_ID/values/$location?&key=$api_key"; $cell_response = $get_cell -> get( $cell_url); $json_body = json_decode($cell_response['body'],true); $cell_value = $json_body['values'][0][0]; return $cell_value; } add_shortcode('get_sheet_value', 'sheet_value_shortcode');
If that is impossible, then would it be possible to have the cell contain a link to the image in google drive or somewhere else and have WordPress show it?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Import picture from google sheets to WordPress’ is closed to new replies.